Use Git with specific ssh-key

The following is a work around for git users to specify his/her ssh-key when using git on a remote/public server.

sudo ssh-agent bash -c 'ssh-add /home/folder/id_rsa; git clone git@host.com:folder/'
sudo ssh-agent bash -c 'ssh-add /home/folder/id_rsa; git push'
sudo ssh-agent bash -c 'ssh-add /home/folder/id_rsa; git pull'
sudo ssh-agent bash -c 'ssh-add /home/folder/id_rsa; git ...'
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s