I'll admit this is a bit of a duplicate of this question but I still cannot get a PAT token to work with Github and VS Code. I have tried following the solutions linked in that article, with no success. I'm not sure if I did something in my configuration while fighting with it to get it to work, but now I cannot even use it to push from the command line. I was able to make the same token work inside VS Code with the settings sync extension to synchronize the settings and it was accepted, but I cannot get it to work for the repo. I checked the permissions and it has access to admin:repo, gist, and repo permissions inside Github. I'm still pretty new to both, but I'm trying to get this functional so I can write better code the first time. When I try use authenticate I get the following error:
remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/.../....git/'
I do make it work when the credentials are cached.
Meaning: putting aside VSCode for a moment, check if you can do a git ls-remote https://github.com/<yourAccount>/<yourPrivateRepo>
with 2FA activated.
If your git config credential.helper
is set "manager" on Windows, OSX Keychain on Mac), you should see a popup asking you for your credentials: enter your GitHub account and your PTA (Personal Token Access).
If the ls-remote
works, then you can launch VSCode, which should be able to access the same repo, through the same URL.
In a Linux context, the OP Brian Hawkins confirms in the comments:
Adding
PATH=%PATH%:/usr/share/doc/git/contrib/credential/libsecret git
to my user profile did the trick!