How to Generate GitHub SSH Keys |Video upload date:  · Duration: PT19M15S  · Language: EN

Quick guide to create SSH keys for GitHub add the public key to the account and test secure git access from a local machine

If you are tired of typing your password every time git nags you then SSH keys are the tiny miracle you need. This guide walks through generating a modern ed25519 key, loading it into the ssh agent, adding the public key to your GitHub account, and testing the connection. Expect slightly less frustration and marginally more security.

Quick reality check

First do not overwrite something that already works. Check for existing identities in the default SSH folder so you do not accidentally retire a key that still pushes critical code.

ls -al ~/.ssh

Create a modern SSH key

ed25519 gives you a small fast key with strong crypto. Use ssh-keygen and give it a helpful comment like your email. Use a passphrase if you do not enjoy living dangerously.

ssh-keygen -t ed25519 -C "your_email@example.com"

When prompted pick a file name if you want multiple keys for different accounts. A passphrase is optional but recommended because a stolen private key with no passphrase is the developer equivalent of leaving your front door open and the welcome mat out.

Load the private key into the ssh agent

The ssh agent holds your unlocked keys so you do not have to type the passphrase for every git operation. Start the agent and add your key.

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

On macOS you can integrate with the keychain and on Linux use your desktop keyring for persistence. If you reboot and the agent forgot your key that is normal, so add it again or configure auto loading per your platform.

Add the public key to your GitHub account

Copy the public key and paste it into the GitHub web UI under SSH and GPG keys. Give the key a clear title so you do not have to play treasure hunt later.

cat ~/.ssh/id_ed25519.pub

Use distinct titles like Work Laptop or Home Desktop so you can revoke one key without setting the world on fire.

Test the SSH connection

Verify that GitHub knows your key and that authentication actually works before pushing anything important. You should see a friendly confirmation message or a polite refusal if something is wrong.

ssh -T git@github.com

If the host is unknown accept the host key when prompted or add it to known hosts first with ssh-keyscan. If GitHub responds with a short welcome you are all set.

Troubleshooting and practical tips

  • File permissions matter. Keep your private key private with chmod 600 ~/.ssh/id_ed25519
  • Use a ssh config file to manage multiple keys and accounts. Example entry
cat >> ~/.ssh/config <
  • Do not commit your private key to any repo ever. That is not a joke.
  • Rotate keys occasionally and remove old keys from your GitHub account for neatness and security.
  • If you see permission denied check that the right key is loaded in your agent and that GitHub shows the matching public key.
  • If you use multiple GitHub accounts set different Host aliases in your config to keep identities from colliding.

Why this helps

Using SSH keys removes password prompts and cuts down on leaked credentials. The private key stays on your machine and GitHub only needs the public key to verify you. That means safer pushes pulls and less time retyping passwords while you stare into the void.

If you want a one line summary without the snark here it is. Generate an ed25519 key add it to the ssh agent upload the public key to GitHub and test the connection. Then go do something more exciting than typing a password three times a day.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.