Skip to content

Instantly share code, notes, and snippets.

@rupeshtiwari
Last active July 11, 2026 06:35
Show Gist options
  • Select an option

  • Save rupeshtiwari/1be93b39b592b06ab3fa183440a6207a to your computer and use it in GitHub Desktop.

Select an option

Save rupeshtiwari/1be93b39b592b06ab3fa183440a6207a to your computer and use it in GitHub Desktop.
github ssh login.md

Perfect, here's your setup with your exact details filled in:


1. Generate the key pair

ssh-keygen -t ed25519 -C "roopkt@gmail.com"
  • Press Enter to accept the default location (~/.ssh/id_ed25519)
  • Set a passphrase (recommended) or press Enter to skip

Creates two files:

File What it is Share it?
~/.ssh/id_ed25519 Private key ❌ NEVER share
~/.ssh/id_ed25519.pub Public key ✅ Upload to GitHub

2. Start ssh-agent and add your key

eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

(On Linux, just use ssh-add ~/.ssh/id_ed25519)


3. Copy the PUBLIC key

pbcopy < ~/.ssh/id_ed25519.pub

It looks like: ssh-ed25519 AAAAC3Nza... roopkt@gmail.com


4. Add it to GitHub (account: rupeshtiwari)

  1. Go to https://github.com/settings/keys (make sure you're logged in as rupeshtiwari)
  2. Click "New SSH key"
  3. Fill in:
    • Title: MacBook - Rupesh
    • Key type: Authentication Key
    • Key: paste (Cmd+V)
  4. Click "Add SSH key"

5. Test it

ssh -T git@github.com

Type yes to confirm the fingerprint the first time. Success:

Hi rupeshtiwari! You've successfully authenticated, but GitHub does not provide shell access.

Seeing your username rupeshtiwari there confirms it worked.


6. Use SSH with your repos

Clone your Pluralsight repo over SSH:

git clone git@github.com:rupeshtiwari/pluralsight-designing-data-systems-llms.git

Switch an existing HTTPS repo to SSH:

git remote set-url origin git@github.com:rupeshtiwari/<repo-name>.git

Verify it switched:

git remote -v

Here's your ~/.ssh/config setup so your personal GitHub key stays cleanly separated from any work keys.


1. Create (or edit) your SSH config

touch ~/.ssh/config
chmod 600 ~/.ssh/config
open -e ~/.ssh/config    # opens in TextEdit; or use: nano ~/.ssh/config

2. Add this block

# ---- Personal GitHub (rupeshtiwari / roopkt@gmail.com) ----
Host github-personal
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes
    AddKeysToAgent yes
    UseKeychain yes

If you ever add a work key later, you'd drop in a second block with its own alias and IdentityFile, so the two never clash:

# ---- Work GitHub (example, add only if needed) ----
Host github-work
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_work
    IdentitiesOnly yes

IdentitiesOnly yes is the important line: it forces SSH to use only the key you named for that host, instead of throwing every key in your agent at GitHub (which causes the "too many authentication failures" error).


3. How you use the alias

Because the host alias is github-personal, your clone/remote URLs use that instead of github.com:

# Clone
git clone git@github-personal:rupeshtiwari/pluralsight-designing-data-systems-llms.git

# Switch an existing repo to use the personal alias
git remote set-url origin git@github-personal:rupeshtiwari/<repo-name>.git

Test it:

ssh -T git@github-personal

Success:

Hi rupeshtiwari! You've successfully authenticated, but GitHub does not provide shell access.

4. Match your commit identity for personal repos

So commits attribute to your personal account, set this per repo (not global, since you're on the Amazon machine):

cd <your-repo>
git config user.name "rupeshtiwari"
git config user.email "roopkt@gmail.com"

Verify:

git config user.email    # should print roopkt@gmail.com

Mental model

  • Host github-personal is just a nickname. When you type git@github-personal:..., SSH looks up that block, connects to the real github.com, and uses only your personal key.
  • Add a second Host block per additional account. The alias in the URL is what picks the key. No clashing, no wrong-account commits.

That's the whole thing. Once you clone with the github-personal alias, git push / git pull just work with no password.

Here's the one-liner to confirm exactly which key GitHub is accepting:

ssh -vT git@github-personal 2>&1 | grep -E "Offering|Server accepts|Authenticated|Hi "

Run it and you'll see output like:

debug1: Offering public key: /Users/rupeshti/.ssh/id_ed25519 ED25519 SHA256:xxxx...
debug1: Server accepts key: /Users/rupeshti/.ssh/id_ed25519 ED25519 SHA256:xxxx...
Authenticated to github.com
Hi rupeshtiwari! You've successfully authenticated...

How to read it:

  • Offering public key: → the key your machine tried
  • Server accepts key: → the key GitHub actually accepted (this is the one in use)
  • Hi rupeshtiwari! → confirms it mapped to your personal account

Handy variations

See every key your agent is throwing at GitHub (diagnoses "too many authentication failures"):

ssh-add -l

Full verbose trace if a push ever gets rejected:

GIT_SSH_COMMAND="ssh -v" git push 2>&1 | grep -E "Offering|accepts|denied"

Confirm a repo is using the right alias + identity:

git remote -v && git config user.email

Remote should show git@github-personal:... and email should be roopkt@gmail.com.


That's your complete SSH setup: key generated, agent configured, ~/.ssh/config with isolated personal host, commit identity set, and now a verification one-liner. Once Server accepts key shows your id_ed25519, you're fully wired — git push/pull will work passwordless with no account clashing.

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