0

I am "trying" this in server:

# ~/.ssh/config
Host github.com
  IdentityFile xxxx

What should I put in xxxx so when I do in server:

git clone git@github.com:myuser/myrepo.git

Git uses a identity in my local, NOT in server, which is located in ~/.ssh/my_another_private_key_file and not uses the default key ~/.ssh/id_rsa?

sites
  • 21,417
  • 17
  • 87
  • 146

1 Answers1

3

This should go in your ~/.ssh/config file on the machine that you're doing the git clone:

Host github.com
  IdentityFile ~/.ssh/my_another_private_key_file

If you're doing the clone on the server and the my_another_private_key_file is on local, you might want to add put it in ~/.ssh/identity on server, so when you ssh-add there, it gets added to your ssh-agent process.

  • 2
    This seems against ssh agent purpose, since I would copy private key to server, right? – sites Oct 12 '13 at 03:59