I've been using Git for a while now, but the constant requests for a password are starting to drive me up the wall.
I'm using Mac OS X and GitHub, and I set up Git and my SSH keys as instructed by GitHub's Set Up Git page.
I've also added the github SSH key to my Mac OS X keychain, as mentioned on GitHub's SSH key passphrases page. My public key is registered with Git.
Nevertheless, every time I try to Git pull, I have to enter my username and password. Is there something other than an SSH key that I need to set up for this?
I think you may have the wrong Git repository URL.
Open .git/config
and find the [remote "origin"] section. Make sure you're using the SSH one:
ssh://[email protected]/username/repo.git
You can see the SSH URL in the main page of your repository if you click Clone or download and choose ssh.
And NOT the https
or git
one:
https://github.com/username/repo.git
git://github.com/username/repo.git
You can now validate with just the SSH key instead of the username and password.
If Git complains that 'origin' has already been added
, open the .config
file and edit the url = "..."
part after [remote origin]
as url = ssh://github/username/repo.git
The same goes for other services. Make sure the address looks like: protocol://something@url
E.g. .git/config
for Azure DevOps:
[remote "origin"]
url = https://[email protected]/mystore/myproject/
fetch = +refs/heads/*:refs/remotes/origin/*