0

I followed the official tutorial in order to setup a git server for the first time. When I executed the following:

$ git remote add origin git@gitserver:/opt/git/project.git
$ git push origin master

I was asked for the password of git@gitserver, which I thought was weird, but entered it anyway.

Then when I tried to clone the repository by doing this:

$ git clone git@gitserver:/opt/git/project.git

or push to it using this:

$ git push origin master

I was asked for the password for git@gitserver every time. I checked and authorized_users contains the public key of the user that's trying to push or clone. Also, I tried what is suggested answer to this question, but that didn't help.

How can I set the server and the client so that I am not asked for a password every time I commit?

UPDATE

Output of ssh -v -i ~/.ssh/id_rsa git@gitserver:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitserver [XXX_REDACTED_gitserver_IP] port 22.
debug1: Connection established.
debug1: identity file /home/XXX/.ssh/id_rsa type 1
debug1: identity file /home/XXX/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA XXX_REDACTED_PUBLIC_KEY_XXX
debug1: Host 'gitserver' is known and matches the ECDSA host key.
debug1: Found key in /home/XXX/.ssh/known_hosts:12
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/XXX/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
debug1: Authentications that can continue: publickey,password
git@gitserver's password:
7
  • So by that suggested answer, I presume you've set up your .ssh/config, but what happens when you run ssh -i ~/.ssh/id_rsa git@gitserver (or -i to wherever your private key is)? Commented Feb 28, 2016 at 17:07
  • It still asks for the password of the git user. Commented Feb 28, 2016 at 21:06
  • And yes, I've setup .ssh/config as so: host & HostName are <ip address of server>; IdentityFile is ~/.ssh/id_rsa; User is git. Commented Feb 28, 2016 at 21:07
  • It would likely help if you chould attach the output of ssh -v -i ~/.ssh/id_rsa git@gitserver Commented Feb 28, 2016 at 23:33
  • Oh, thanks, updating the question... Commented Feb 29, 2016 at 10:29

1 Answer 1

1

Please make sure you're using the correct private/public key pair. You can verify this by directly pointing to the key using ssh -v -i [private key file] git@gitserver and checking the output.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.