Matthew Colley
Matthew Colley

Reputation: 11466

Private GIT SSH Prompts for Password, can SSH to remote repository without password

I have GIT running on a private server using SSH. Every time I pull from the remote I am prompted for a password:

AWS-Box:/home/git/site$ sudo git pull origin master
git@remoteserver password: 

However I have the SSH keys set up on the server, so that I can SSH from the server to the private repository, and I am not prompted for a password:

AWS-Box:/home/git/site$ ssh git@remoteserver
Last login: Wed Aug 13 12:12:14 2014 from AWS-Box
[git@remoteserver ~]$ 

I checked my git remotes they are:

 origin ssh://git@remoteserver/~/git/site (fetch)
 origin ssh://git@remoteserver/~/git/site (push)

So I am using SSH not https:// I have opened the /var/log/auth.log and see the log full of this:

 Aug 13 12:19:11 sudo: pam_unix(sudo:session): session opened for user root by ubuntu(uid=1000)
 Aug 13 12:19:19 sudo: pam_unix(sudo:session): session closed for user root

unsure where to go as next step. I can SSH from command line to the remote server without a password, but when performimg a GIT pull am prompted for password

Upvotes: 0

Views: 162

Answers (1)

Stephan Rodemeier
Stephan Rodemeier

Reputation: 717

You are using sudo for your git pull. Try it without sudo and your key should be used properly.

Upvotes: 2

Related Questions