+2 votes
1 view
in Devops and Agile by (22.3k points)
edited by

I've been using Git for a while now, but the constant requests for a password are starting to drive me up to 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?

1 Answer

+3 votes
by (38.3k points)

For this, you might be using a wrong url for git repository.

Open .git/config file and find the [remote "origin"] section. Make sure you're using the SSH one:

ssh://git@github.com/username/repo.git

Note: You can see the SSH URL on the main page of your repository if you click Clone or download and choose ssh. Don’t use http or git url.

Now, you can just validate with the SSH key instead of using a username or password.

If the git shows origin has already been added then you need to open the .config file and edit the url = "..." after that  [remote origin] as url = ssh://github/username/repo.git.

by (22.3k points)
Helpful answer, thanks.
by (16.9k points)
Thank you. Worked out for me.
...