GitHub needs a way to verify that it is really you when you push code to your account. The recommended method is SSH key authentication, which is more secure than a password and, once configured, requires no further action from you.
Key Concept: Public and Private Keys
SSH authentication works by generating two mathematically linked files: a private key stored only on your computer and a public key that you share with GitHub. When you connect to GitHub, your computer proves it holds the private key without ever revealing it — like a lock-and-key system where the lock is public but the key is yours alone.
The private key lives at ~/.ssh/id_ed25519.
Never share your private key
The file you upload to GitHub is the public key — id_ed25519.pub, with
the .pub extension. Never share, upload, or email the private key file.
Step 1: Generate an SSH key pair¶
When prompted for a file location, press Enter to accept the default
(~/.ssh/id_ed25519). You may change the name of the key if you would like to better indicate that it is for Github. When prompted for a passphrase, you may press Enter twice
to leave it empty, or set a passphrase for additional security.
Step 2: Copy your public key¶
Step 3: Add the public key to GitHub¶
- Log in to github.com
- Click your profile picture (top right) → Settings
- In the left sidebar, click SSH and GPG keys
- Click New SSH key
- Give it a descriptive title, for example: Laptop 2025
- Paste your public key into the Key field
- Click Add SSH key
Step 4: Test the connection¶
A successful connection produces:
If you see a warning about the host's authenticity on first connection, type yes and
press Enter — this is expected behavior.
Full documentation is at docs.github.com — Connecting to GitHub with SSH.
What's next: VS Code and Jupyter — the editor and notebook environment where you will write all of your code.