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 installed in my PC GitHub Desktop and also Git, I already ran:
git config --global credential.helper wincred
but still Visual Studio Code is asking for the credentials.
Any help?
here is my .gitconfig file located in the user profile folfer:
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[user]
name = ddieppa
[user]
email = fake@live.com
[credential]
helper = wincred
Here is the popup windows asking for the credentials:
I enter my GitHub credentials in the popup, but still getting this error in the Git output window in Visual Studio Code:
remote: Anonymous access to ddieppa/LineOfBizApp.git denied.
fatal: Authentication failed for 'https://github.com/ddieppa/LineOfBizApp.git/'
For me I had setup my remote repo with an SSH key but git could not find them because the HOMEDRIVE environment variable was automatically getting set to a network share due to my company's domain policy. Changing that environment variable in my shell prior to launching
code .
caused VSCode to inherit the correct environment variable and viola no more connection errors in the git output window.Now I just have to figure out how to override the domain policy so HOMEDRIVE is always pointing to my local
c:\users\marvhen
directory which is the default location for the.ssh
directory.Use ssh instead of http/https.
You will need to set ssh keys on your local machine, upload them to your git server and replace the url form
http://
togit://
and you will not need to use passwords anymore.If you cant use ssh add this to your config:
documents are here.
Using ssh key in github
Simply follow those steps and you will set up your ssh key in no time:
Generate a new ssh key (or skip this step if you already have a key)
ssh-keygen -t rsa -C "your@email"
Once you have your key set in
home/.ssh
directory (orUsers/<your user>.ssh
under windows), open it and copy the contentHow to add sh key to github account?
SSH keys
Add ssh key
And you all set to go :-)
The following steps walk you through how to:
**Generating SSH keys without a passphrase is unwise if your work is particularly sensitive.
OS - Fedora 28 | Editor - VS Code v1.23.0 | Repository - Git
Generate SSH keys:
ssh-keygen -t rsa -C "email@goeshere.com"
After completing the above steps, the location of your public key is shown in the terminal window. If the currently logged in user is 'bob' the location of your public key would be /home/bob/.ssh/id_rsa.pub
Copy and import public key to GitHub:
cat /home/bob/.ssh/id_rsa.pub
Copy the whole public key that is now displayed in your terminal window to the clipboard
Confirm the above steps:
ssh -T git@github.com
yes
Hi ! You've successfully authenticated, but GitHub does not provide shell access.
First commit / push without having to enter a username / password: -
touch test.txt
git add test.txt
git commit
- opens editor, enter a message and save the file. If vi is your editor, pressi
once the file opens, enter a message, press esc, and then enter:x
to save changes.git push
The only hiccup you may encounter is when you attempt to SSH to GitHub. This link will provide some assistance -
Happy hunting!
Try installing "Git Credential Manager For Windows" (and following instructions for setting up the credential manager).
When required within an app using Git (e.g. VS Code) it will "magically" open the required dialog for Visual Studio Team Services credential input.
All I had to do was to run this command:
git config --global credential.helper wincred
Then I was prompted for password twice.
Next time it worked without prompting me for password.
You should be able to set your credentials like this:
git remote set-url origin https://<USERNAME>:<PASSWORD>@bitbucket.org/path/to/repo.git
You can get the remote url like this:
git config --get remote.origin.url