Skip to content

Instantly share code, notes, and snippets.

@teebow1e
Last active June 30, 2025 06:24
Show Gist options
  • Select an option

  • Save teebow1e/7af5d089f6b3f492943157869029dc41 to your computer and use it in GitHub Desktop.

Select an option

Save teebow1e/7af5d089f6b3f492943157869029dc41 to your computer and use it in GitHub Desktop.
Integrate SSH keys to GitHub for working with private repo (or personal access)

Step-by-step guide

  1. Create a SSH key
ssh-keygen -t rsa -C "your_email@example.com"
# this is also okay
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
# maybe this (up to your preference)
ssh-keygen -t ed25519 -C "your_email@example.com"
  1. Copy the key to clipboard
  2. Paste into GitHub SSH and GPG keys page
  3. Verify the connectivity
ssh -T -v git@github.com
# or this if you use custom key name (instead of the normal id_rsa)
# more information: https://serverfault.com/questions/1119891/ssh-not-working-when-custom-key-name-is-used
ssh -T -v -i <custom_file_name> git@github.com
  1. By default, for some reason, new session of Bash/ZSH may not load your SSH key, therefore, you need to initialize a SSH agent and load your key each time you start a new session.
ssh-add &>/dev/null || eval `ssh-agent` &>/dev/null
[ $? -eq 0 ] && {
  ssh-add ~/.ssh/<your_key_name> &>/dev/null
}

Sidenote: If you are using SSH key and works with private stuff, you need to interact with them using SSH protocol, not HTTP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment