1. Checking for existing SSH keys
ls -al ~/.ssh
2.Generating a new SSH key
ssh-keygen -t rsa -b 4096 -C "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.
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 firstname.lastname@example.org
– You may see one of these warnings:
The authenticity of host ‘github.com (126.96.36.199)’ 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://email@example.com/<user>/<repository name>.git