0

Since this weekend, I'm unable to clone or update private repositories in Visual Studio Code, either from Windows or Linux. My latest attempt in Windows was to completely sign out of GitHub from Visual Studio Code, quit, restart, and then try to sync again.

I have no problem with my public repository. For my private ones, I also tried by removing the local copy and clone again. Still no luck.

Validating found git in: C:\Program Files\Git\cmd\git.exe
Validating found git in: C:\Program Files (x86)\Git\cmd\git.exe
Validating found git in: C:\Program Files\Git\cmd\git.exe
Validating found git in: C:\Users\user\AppData\Local\Programs\Git\cmd\git.exe
Validating found git in: C:\Users\user\Programs\git\bin\git.exe
Using git 2.29.2.windows.2 from C:\Users\user\Programs\git\bin\git.exe
> git rev-parse --git-dir
Open repository: c:\Users\user\GitHub\ivql
> git fetch
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --local branch.main.github-pr-owner-number
> git config --get commit.template
> git check-ignore -v -z --stdin
> git rev-parse --git-dir
> git status -z -u
Open repository: c:\Users\user\GitHub\private_repo1
> git fetch
> git status -z -u
> git symbolic-ref --short HEAD
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --get commit.template
> git check-ignore -v -z --stdin
> git check-ignore -v -z --stdin
> git config --local branch.main.github-pr-owner-number
> git config --get commit.template
> git config --local branch.main.github-pr-owner-number
> git config --local branch.main.github-pr-owner-number
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/mrgou/private_repo1.git/'
> git clone https://github.com/user/private_repo2.git c:\Users\user\GitHub\private_repo2 --progress
Cloning into 'c:\Users\user\GitHub\private_repo2'...
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/user/private_repo2.git/'

On Linux, I tried all tips I could find on the subject, including signing out from Visual Studio Code, or authenticating again with a personal access token with git remote set-url origin https://<TOKEN>@github.com/<user_name>/<repo_name>.git. No luck...

Did something happen in GitHub recently?

If I make the repository public, I can clone it in Visual Studio Code, but once I make it private again, sync fails (authentication failed).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mrgou
  • 1,576
  • 2
  • 21
  • 45
  • Have you tried syncing with a different repo (like GitLab) to make sure it's a problem specific to GitHub? – Epoch Nov 15 '21 at 17:09
  • Yes, same with GitLab (although I might have things done wrong here, the integration in VSCode isn't as transparent and I might have missed something). BTW, on Linux, the `gh` client fails cloning as well, even after a successful authentication. – mrgou Nov 15 '21 at 17:16
  • 1
    I notice that you are trying to use `https:` authentication. But that's pretty much dead. Switch to SSH and I bet things will be fine. – matt Nov 15 '21 at 20:08
  • 1
    @phd, thanks, looks that it's indeed a widespread issue. Interestingly, I get that issue in GitHub Desktop as well, so I wonder what VS Code has to do with it. – mrgou Nov 15 '21 at 20:58
  • A candidate for the canonical question is *[Fix for "fatal: Authentication failed for"](https://stackoverflow.com/questions/69979522/)* (despite the unspecific title). – Peter Mortensen Nov 19 '21 at 21:22

1 Answers1

0

It is a known issue to be fixed in a future release. See here.

The workaround is to unset Git: Terminal Authentication in the Visual Studio Code settings.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mrgou
  • 1,576
  • 2
  • 21
  • 45