This is a quick post on how to configure GitHub SSH keys. The GitHub documentation is pretty good with this, so this post is more of a personal note.
The advantage of using GitHub SSH keys is that you do not need to provide the username and password of your GitHub account each time. This makes it easier to work with GitHub, more specifically private repositories in my opinion.
To add the SSH keys you need to
- Create SSH keys
- Import the SSH key to GitHub
- Save SSH key in Linux
1. Create SSH Keys
Here we have the option of using RSA 4096 bit keys, or we can use Eliptic Curve 25519 algorithm. The EC-25519 curve is the one that is used in the famous Eliptic Curve Diffie-Hellman key exchange algorithm.
# EC-25519 ssh-keygen -t ed25519 -C "email@example.com" # RSA 4096 ssh-keygen -t rsa -b 4096 -C "firstname.lastname@example.org"
2. Import the SSH Key to GitHub
Go to your icon on the top right, Settings, then SSH and GPG keys. Click New SSH Key on the top right. Then copy and paste your public key into the text box, like in the screenshots below.
3. Configure Linux with Key
Two simple commands! The agent PID is likely going to be different for you. Also you need to make sure that you use the correct path to your private key. If you configured a passphrase for your SSH key, you need to type it in here.
$ eval `ssh-agent -s` # Agent PID #### $ ssh-add /home/user/.ssh/id_ed_25519
And that’s all it takes! Now you can test it out 🙂
Test it out
Note that you will need to create a repo in the GitHub website for this.
git config --global user.name YourUserName mkdir project-folder cd project-folder git init echo "# Hello World" > README.md git add README.md git commit -m "Frosty Labs Demonstration" git remote add origin email@example.com:YourUserName/project-folder.git git push -u origin master