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:
.ssh/config, but what happens when you runssh -i ~/.ssh/id_rsa git@gitserver(or -i to wherever your private key is)?ssh -v -i ~/.ssh/id_rsa git@gitserver