Clone repository via SSH in Github

1. Checking for existing SSH keys

ls -al ~/.ssh
2.Generating a new SSH key

ssh-keygen -t rsa -b 4096 -C ""

* When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location. Then type a secure passphrase
3.Adding your SSH key to the ssh-agent
– Turn on ssh-agent

eval “$(ssh-agent -s)”

– Add your SSH key to the ssh-agent. If you used an existing SSH key rather than generating a new SSH key, you’ll need to replace id_rsa in the command with the name of your existing private key file.

ssh-add ~/.ssh/id_rsa

4. Add the SSH key to your GitHub account
– Copy the SSH key to your clipboard:
clip < ~/.ssh/
– On Github, In the top right corner of any page, click Settings =>  click SSH and GPG keys => Click New SSH key => enter title and Paste your key into the “Key” field => Confirm the action by entering your GitHub password
5. Testing your SSH connection (
– Open Git Bash
ssh -T
– You may see one of these warnings:
The authenticity of host ‘ (’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
– then type yes:
– Verify that the resulting message contains your username

5. Clone via SSH
git clone ssh://<user>/<repository name>.git


Leave a Reply

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

You are commenting using your 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