The first thing to do is generating a new SSH key and adding it to the ssh-agent:
(we need a Github account for this)
Generating a new SSH key:
$ ssh-keygen -t rsa -b 4096 -C «your_email@example.com»
Adding your SSH key to the ssh-agent:
# start the ssh-agent in the background
$ eval $(ssh-agent -s)
> Agent pid 59566
$ ssh-add ~/.ssh/id_rsa
Then to make a git clone through ssh:
git clone ssh://git@github.com/<user>/<repository name>.git
ssh and git pull from remote server:
ssh root@server2 ‘cd /root/.example; git pull origin master’