For absolutely no reason that I may think of, the Visual Studio Code built-in Git SCM stopped working, only returning authentication failed, not only in Visual Studio Code, but also in the terminal.
A weird thing is that last night it was working fine. Just to wonder today it’s not working any more.
- I use Ubuntu 21.04 (Hirsute Hippo), and I have two-factor authentication enabled in GitHub.
- I tried to create a personal access token, but I can’t find anywhere to put it for Git SCM in Visual Studio Code to work correctly across all repositories without exposing it.
By Visual Studio Code Git SCM stopped working I mean:
- Can't pull/push to a remote repository using the built-in Git extension in Visual Studio Code
- Can't issue the clone command for private repositories
How can I re-enable the extension functionalities, without using email and password or appending access token before the remote URL path as specified here?
PS: I have the GitHub Copilot Git extension enabled and it’s authenticated properly in Git (properly working)
CodePudding user response:
Check first if your remote URL is an HTTPS one (in command-line: once this is working there, you can switch back to VSCode):
cd /path/to/repo
git remote -v
If HTTPS, check what credential helper is used to cache your credentials. An old password might be cached, which is no longer valid, since now only PAT (Personnal Access Token) are allowed (following the Aug. 2021 policy change).
git config --global credential.helper
xxx
printf "host=github.com\nprotocol=https" | git-credential-xxx get
(replace xxx by the output of git config --global credential.helper
)
If this is the wrong "password" (ie., not your current token), erase the old one and store the new one.
printf "host=github.com\nprotocol=https" | git-credential-xxx erase
printf "host=github.com\nprotocol=https\nusername=MyGitHubUserAccount\npassword=yyy" | git-credential-xxx store
CodePudding user response:
VSCode updated a few days ago to 1.62.2-1636665017
.
This update would appear to be the trigger for the problem.
There is an open issue for this problem.