Reputation: 107
I am trying to clone a git repo on a university server but I have only r-x
access to the .ssh
folder. Hence, I can't generate rsa keys in the .ssh
folder, which I need for accessing the server where the git repo is.
I now generated the keys in a git_keys directory in my home dir.
Is it possible to tell git clone to take the rsa keys from a different directory than ~/.ssh
?
Upvotes: 5
Views: 11631
Reputation: 1326706
Checking man ssh
, you can at least specify the path of the private key with -i
ssh -i /path/to/private_key
The other approach is to use a config file (by default in ~/.ssh/config
), but you can, with the -F
option, specify a different config file.
You can, however, avoid the config file entirely, with "How to specify an SSH key with git, without using a config file"
ssh-agent bash -c 'ssh-add /path/to/private_key; git pull'
Upvotes: 7