Question

I am having difficulty SSH'ing git commands (e.g. git pull) without having to GitHub enter username and passcode.

I can SSH into my Dreamhost server and manually run git pull. I then have to enter my GitHub username and passcode. This is fine and dandy but I'd like to run git pull WITHOUT having to enter my GitHub credentials every time.

Found out that I needed to add SSH keys but the server still asks for GitHub credentials.

I did the following:

  1. SSH'd into Dreamhost shared server using PuTTy

  2. Did the following:

$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/funkyserver/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):   <-- I left this empty

Enter same passphrase again:   <-- I left this empty

Your identification has been saved in /home/funkyserver/.ssh/id_rsa.

Your public key has been saved in /home/funkyserver/.ssh/id_rsa.pub.

The key fingerprint is:

12:c3:12d:88:01:pp:12:b5:ca:33:8g:1q:64:ce:4a:81 funkyserver@wonkyninja  <-- wonkyninja is Dreamhost's server name and this fingerprint is fake

The key's randomart image is:  <-- I left this part out on purpose
  1. Copied the /.ssh/id_rsa.pub key and added it under the 'Deploy Keys' section @ GitHub.com
  2. Back on the Dreamhost server, I SSH'd into the directory with the git repo (e.g. /home/funkyserver/mysite)
  3. Ran git pull and it still asks me to enter GitHub credentials

What am I doing wrong with the SSH keys? Did I not generate them correctly? Did I not add them to GitHub properly?

Please help.

Was it helpful?

Solution

Try doing git remote -v.

If your remotes are prefixed with https:// a password will be asked.

You can change over to the ssh protocol with git remote set-url origin git@github.com:username/repo.git

There is more information in this question and on Github

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top