Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
3 views
in DevOps and Agile by (29.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 (50.2k 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://[email protected]/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.

Git keeps asking for password
Intellipaat-community
by (27.5k points)
Helpful answer, thanks.
by (19.4k points)
Thank you. Worked out for me.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...