-
-
Save mataralhawiti/483e2daa4cf8b5c39fede698f3f7a871 to your computer and use it in GitHub Desktop.
GitHub-SSH-Setup
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
| ## Linux | |
| # 1. Generate SSH key with custom name | |
| ssh-keygen -t ed25519 -f ~/.ssh/github_personal -C "your_email@example.com" | |
| # 2. Start SSH agent | |
| eval "$(ssh-agent -s)" | |
| # 3. Add SSH key to agent | |
| ssh-add ~/.ssh/github_personal | |
| # 4. Configure SSH for GitHub | |
| cat >> ~/.ssh/config <<EOF | |
| Host github.com | |
| HostName github.com | |
| User git | |
| IdentityFile ~/.ssh/github_personal | |
| EOF | |
| # 5. Copy public key | |
| cat ~/.ssh/github_personal.pub | |
| # 6. Test connection | |
| ssh -T git@github.com | |
| ## Mac | |
| # 1) Generate SSH key with custom name | |
| ssh-keygen -t ed25519 -f ~/.ssh/github_personal -C "your_email@example.com" | |
| # 2) Start SSH agent | |
| eval "$(ssh-agent -s)" | |
| # 3) Add SSH key to agent | |
| # macOS tip: store passphrase in Keychain (if supported by your ssh-add) | |
| ssh-add --apple-use-keychain ~/.ssh/github_personal | |
| # If you get: "ssh-add: illegal option -- apple-use-keychain" | |
| # follow GitHub's troubleshooting page (your ssh-add doesn't support it) and just run: | |
| # ssh-add ~/.ssh/github_personal | |
| # :contentReference[oaicite:1]{index=1} | |
| # 4) Configure SSH for GitHub | |
| mkdir -p ~/.ssh | |
| cat >> ~/.ssh/config <<'EOF' | |
| Host github.com | |
| HostName github.com | |
| User git | |
| IdentityFile ~/.ssh/github_personal | |
| AddKeysToAgent yes | |
| UseKeychain yes | |
| EOF | |
| # 5) Copy public key (macOS clipboard) | |
| pbcopy < ~/.ssh/github_personal.pub | |
| echo "Public key copied to clipboard. Paste it into GitHub > Settings > SSH and GPG keys." | |
| # 6) Test connection | |
| ssh -T git@github.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment