Red-DiscordBot icon indicating copy to clipboard operation
Red-DiscordBot copied to clipboard

Detect git authentication failure

Open Jan200101 opened this issue 4 years ago • 1 comments

closes #2749

the logic implemented has been tested against https clones and ssh clones using the following addition to .gitconfig

[url "ssh://[email protected]/"]
    insteadOf = https://github.com/

I've decided to go against reporting it as a missing repository because we cannot know if the repo is truly missing or simply behind authentication.

Some more environment variables are set or removed when running a command to ensure git doesn't do anything smart with appropriate comments and links to the related code in git.

Right now this bundles ERROR: Repository not found. with other permission errors (since it also returns fatal: Could not read from remote repository.) but that can be changed if desired.

For reference, here is a list of git errors and approriate regexes https://github.com/desktop/dugite/blob/master/lib/errors.ts#L64

Jan200101 avatar Oct 24 '21 09:10 Jan200101

Perhaps adding tests for this would be worthwhile.

One way I could think of is cloning from a user that cannot exist like Ghost: https://github.com/ghost/non-existant-repo

Jan200101 avatar Oct 24 '21 09:10 Jan200101