Last active
June 30, 2025 06:24
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Step-by-step guide | |
| 1. Create a SSH key | |
| ```shell | |
| 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" | |
| ``` | |
| 2. Copy the key to clipboard | |
| 3. Paste into [GitHub SSH and GPG keys page](https://github.com/settings/keys) | |
| 4. Verify the connectivity | |
| ```shell | |
| 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 | |
| ``` | |
| 5. 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. | |
| ```shell | |
| ssh-add &>/dev/null || eval `ssh-agent` &>/dev/null | |
| [ $? -eq 0 ] && { | |
| ssh-add ~/.ssh/<your_key_name> &>/dev/null | |
| } | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment