Set github personal access token in visual studio code
Answer a question
I am trying to set the personal access token in VS code, but it doesn't seem to accept it. I put it in the "Github: Set Personal Access Token" in the command palette but it doesn't seem to have any effect. I also put the token in the Windows Credentials manager.
When I try to push, I get this error:
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://<usr>:token@github.com/<us>/repository.git/': The requested URL returned error: 403
Answers
Make sure you have the latest Git for Windows, and the git config --global credential.helper set to manager-core.
From there, check you do have indeed the token as password stored in the credential helper, using a CMD (not git bash):
printf "protocol=https\nhost=github.com"|"C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager-core.exe" get
protocol=https
host=github.com
username=VonC
password=ghp_Dxc...<yourToken>
Make sure that token starts with ghp_ (following the new token format update).
If not, remove it:
printf "protocol=https\nhost=github.com"|"C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager-core.exe" earase
Then the next push will ask and store your new credentials.
No need to manually tweak the Windows Credential Manager: that is what those helpers are for.
From the discussion, the problem was twofold:
- The System User Windows path did not reference the Git installation path
- The remote URL registered in the local repository did include directly the token (instead of relying on the git credential manager)
Solving those two issues allowed VSCode to start pushing with the proper credentials.
更多推荐


所有评论(0)