When I try to ssh -C user@my_server 'cd /home/me/my_repo'
it works.
When I try to ssh user@my_server
, then cd /home/me/my_repo'
and then git pull
it works.
But when I try to ssh -C user@my_server 'cd /home/me/my_repo' && git pull
it fails with Permission denied (publickey)
.
My question really is : Why does it even work locally? When I do ssh -C user@my_server 'cd /home/me/my_repo && git pull'
does git care about what ssh key I used to connect to my_server, not just the ssh key used to connect to my_repo's remote?