Our Feature Flags course is now live!

Github SSH Setup

Quick write-up on setting up github ssh

Thanks to @ksridhar02 for helping us write this!

AI-powered write-up, verify yourself!

This is one of those things, most developers (including me) just install and use without thinking about it. So, just doing quick-AI write-up to learn it.

The developer's most used tool was Github, so every time you push your changes you will be asked to enter your Github details which is a tiresome work so setting an ssh key to your Github will make your life a lot easier.

Official Instructions

You should ideally follow the official instructions provided by GitHub here.

Setup SSH

  • Open Your terminal and set the following
git config --global user.name 'Your GitHub username'
git config --global user.email 'your GitHub associated email'
  • After this step check if you have any SSH keys present locally by this command.
ls ~/.ssh
  • Now you have to generate ssh key in your terminal with the following command and click as enter for all the options as default values will be enough for creating a ssh key
ssh-keygen -t rsa -b 4096 -C "your_github_email@example.com"
  • Now you need to copy your SSH public key and add it to GitHub.

Copying the SSH key

Depending on your operating system, use one of the following methods:

On Linux (with xclip):

sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub

On macOS:

pbcopy < ~/.ssh/id_rsa.pub

This copies the key to your clipboard directly.

On Windows (using Git Bash or PowerShell):

clip < ~/.ssh/id_rsa.pub

This will copy the SSH key to your clipboard.

  • Now open your GitHub account in the browser → SettingsSSH and GPG Keys.
  • Click New SSH Key, give it a descriptive title (e.g., My Laptop SSH), and paste the copied key into the Key field.
  • Save it.

ssh_github.png

  • Now open your terminal and Check the ssh key using this command.
ssh -T git@github.com
  • After this, you will be prompted with this text
Hi Username! You've successfully authenticated, but Github does not support shell access.

Though little cryptic but this message means you have successfully setup Github SSH setup.

Last updated on

On this page