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 "your_email@example.com"

* 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/id_rsa.pub
– 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 (https://help.github.com/articles/testing-your-ssh-connection/)
– Open Git Bash
ssh -T git@github.com
– You may see one of these warnings:
The authenticity of host ‘github.com (192.30.252.1)’ 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://git@github.com/<user>/<repository name>.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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s