I started using Visual Studio Code, and I was trying to save my test project into GitHub, but Visual Studio Code is always asking for my GitHub credentials.
I have i
After fighting with something like this for a little while, I think I came up with a good solution, especially when having multiple accounts across both GitHub and BitBucket. However for VSCode, it ultimately ended up as start it from a Git Bash terminal so that it inherited the environment variables from the bash session and it knew which ssh-agent to look at.
I realise this is an old post but I still really struggled to find one place to get the info I needed. Plus since 2017, ssh-agent got the ability to prompt you for a passphrase only when you try to access a repo.
I put my findings down here if anyone is interested:
This has been working for me:
1. Set credential hepler to store
$ git config --global credential.helper store
2. then verify if you want:
$ git config --global credential.helper
store
Simple example when using git bash quoted from Here (works for current repo only, use --global
for all repos)
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: < type your username >
Password: < type your password >
[several days later]
$ git push http://example.com/repo.git
[your credentials are used automatically]
Will work for VS Code too.
More detailed example and advanced usage here.
Note: Username & Passwords are not encrypted and stored in plain text format so use it on your personal computer only.
I managed to stop this by carrying out the following steps.
cd "C:\Program Files\Git\mingw64\libexec\git-core"
followed by git-credential-manager.exe uninstall
git config --global credential.helper wincred
NOTE: I was using a Personal Access Token as my password.
You can refer this link for setup a Git Credential
You can run the following command to save your git credentials. You no need to enter username and password every git command run. (Its for Windows)
git config --global credential.helper wincred
For Mac / Linux click on this link for How to save Git credentials