I have a git repository in a hosted instance of Atlassian Stash. I then have three machines: olympus, zeus and hera where I deploy the latest release of a software system. To automate this I'd like to remotely deploy from olympus onto the other machines which I try to do using ssh
and git pull
but this fails with Permission denied (publickey).
. I basically do and get:
azg@olympus:~$ ssh azg@zeus 'cd ~/my/project/release/deploy/location/; git pull'
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
I have the following:
- Every machine has a different azg user (haven't had time to install LDAP etc) so I have azg@olympus, azg@zeus and azg@hera. For each user I have generated ssh id_rsa key pairs.
- I have populated each azg user
authorized_keys
with the corresponding id_rsa.pub of the others Stash azg user is configured with a copy of all id_rsa.pub for every azg user (azg@olympus, azg@zeus, azg@hera) so I can clone, pull or push from every machine via ssh without having to enter password each time. Therefore I can do no problems:
azg@olympus:~/code$ git clone ssh://azg@olympus:7999/pm/pm.git Cloning into 'pm'... remote: Counting objects: 555, done. remote: Compressing objects: 100% (271/271), done. remote: Total 555 (delta 203), reused 555 (delta 203) Receiving objects: 100% (555/555), 9.54 MiB, done. Resolving deltas: 100% (203/203), done.
and I can do the same from each machine separately. However, I can't do it if I login remotely first namely it asks me each time for the passphrase for key '/home/azg/.ssh/id_rsa' e.g.
azg@olympus:~$ ssh azg@zeus
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.5.0-43-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Wed Nov 27 17:01:33 2013 from olympus
azg@zeus:~$ cdc
azg@zeus:~/code$ git clone ssh://azg@olympus:7999/pm/pm.git
Cloning into 'pm'...
Enter passphrase for key '/home/azg/.ssh/id_rsa': <<<<<<<<<<< WHY???
remote: Counting objects: 555, done.
remote: Compressing objects: 100% (271/271), done.
remote: Total 555 (delta 203), reused 555 (delta 203)
Receiving objects: 100% (555/555), 9.54 MiB | 145 KiB/s, done.
Resolving deltas: 100% (203/203), done.