ls -al ~/.ssh
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Ensure this file: ~/.ssh/config
, contains the following:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
and then run
ssh-add -K ~/.ssh/id_rsa
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Print and copy the contents of the ssh key to the clipboard:
cat ~/.ssh/id_rsa.pub
Log into Github and go to the keys page in settings (https://github.com/settings/keys) and create a new key with a descriptive title and paste the contents of the key.
Check the remote URL of the repo with git remote -v
. Copy the SSH url from the github repo's Clone button. Go to the repo directory and run:
git remote set-url origin git@github.com:USERNAME/REPOSITORY.git