| <- Previous: Configure Identity | Next: Enable Commit Signing -> |
|---|
Generate an SSH key pair, load it into ssh-agent, and register the public key in GitHub as an authentication key.
- explain the difference between a private key and a public key
- create an
ed25519SSH key pair - use SSH to authenticate from your machine to GitHub
- The private key stays on your machine.
- The public key can be shared safely.
- GitHub uses the public key to verify that your machine is allowed to connect.
- This step handles authentication. It does not sign commits yet.
Run:
ssh-keygen -t ed25519 -C "your_email@example.com"Accept the default path ~/.ssh/id_ed25519. Use a passphrase if possible. A passphrase protects the private key if someone gets access to your machine.
Run:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519ssh-agent keeps the private key available for authentication during your shell session.
Print your public key:
cat ~/.ssh/id_ed25519.pubThen:
- copy the full output
- open GitHub -> Settings -> SSH and GPG keys
- click New SSH key
- select Authentication Key
- paste the public key and save
Run:
ssh-add -l
ssh -T git@github.comThen run the authentication check from the root of your template copy:
bash scripts/run-auth-check.shOn Windows PowerShell, run:
powershell -ExecutionPolicy Bypass -File scripts/run-auth-check.ps1On Windows Command Prompt, run:
scripts\run-auth-check.cmdThe script prints PASS, WARN, and FAIL directly in the terminal. At this stage it skips signing checks on purpose, because signing is configured in the next module.
In this course, many learners clone their template copy with HTTPS before SSH is configured. Once your SSH test works, switch your remote to SSH:
git remote set-url origin git@github.com:your-username/your-repo-name.git
git remote -vAfter that, continue the course using the SSH remote.
ssh-add -llists at least one loaded identity.ssh -T git@github.comreports successful authentication.- You can explain that SSH authentication proves your machine can connect to GitHub, not that a commit is signed.
| <- Previous: Configure Identity | Next: Enable Commit Signing -> |
|---|