đ Quick Start
- Who itâs for: Developers who want verified commits
- Time to complete: 10-15 minutes
- Prerequisites: SSH key (or 2 min to create one)
- Expected outcome: All commits automatically signed and verified on GitHub
- Next step: Optionalâlet Amp verify your setup
Anyone can commit code as you on GitHub. All they need is your name and email from git config. The only difference? No âVerifiedâ badge.
The solution: sign your commits. And the easiest way? Use the SSH key you already have.
GPG (traditional way):
SSH (simpler way):
macOS/Linux:
ls -la ~/.ssh
Windows (PowerShell):
dir C:\Users\YourUsername\.ssh
Look for id_ed25519.pub, id_rsa.pub, or similar. If you donât have one:
macOS/Linux:
ssh-keygen -t ed25519 -C "your_email@example.com"
Windows (PowerShell):
ssh-keygen -t ed25519 -C "your_email@example.com"
macOS/Linux:
# Copy your public key
cat ~/.ssh/id_ed25519.pub # or id_rsa.pub
Windows (PowerShell):
# Copy your public key
type C:\Users\YourUsername\.ssh\id_ed25519.pub
Then:
Note: You can use the same key for both authentication and signingâjust add it twice with different types.
macOS/Linux:
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub # or id_rsa.pub
git config --global commit.gpgsign true
Windows:
git config --global gpg.format ssh
git config --global user.signingkey C:/Users/YourUsername/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
Note: On Windows, use forward slashes (/) in the key path, not backslashes.
Thatâs it! Every commit is now automatically signed.
If youâre asked for your SSH passphrase on every commit:
macOS:
# Add key to ssh-agent with keychain
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Create/edit ~/.ssh/config:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
Linux:
# Start ssh-agent and add key
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
Add to ~/.bashrc or ~/.zshrc to persist:
if [ -z "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519 2>/dev/null
fi
Windows:
Git for Windows includes ssh-agent. Ensure itâs running:
# Start ssh-agent (if not running)
Start-Service ssh-agent
Set-Service -Name ssh-agent -StartupType Automatic
# Add your key
ssh-add C:\Users\YourUsername\.ssh\id_ed25519
Now youâll only enter the passphrase once per session (or never if already cached).
Make a test commit:
git commit --allow-empty -m "Test signed commit"
git log --show-signature -1
Push to GitHub and check for the âVerifiedâ badge next to your commit.
đ¨ Try It Now: Let Amp Validate Your Setup
Task: Use Amp to verify your SSH signing configuration
Prompt:
Check my git config to verify SSH commit signing is set up correctly. Verify: 1. gpg.format is set to ssh 2. user.signingkey points to my SSH public key 3. commit.gpgsign is true 4. The signing key file exists Show me the current config and flag any issues.Verification:
- Amp reads your .gitconfig
- Confirms all settings are correct
- Identifies any missing configuration
Expected outcome: Confidence that your setup is correct, or specific instructions to fix issues.
macOS/Linux:
# Verify key path
git config --global user.signingkey
# Should match your public key location
ls -la ~/.ssh/id_ed25519.pub
Windows:
# Verify key path
git config --global user.signingkey
# Should match your public key location (with forward slashes)
dir C:\Users\YourUsername\.ssh\id_ed25519.pub
Use forward slashes in path: C:/Users/YourUsername/.ssh/id_ed25519.pub
See the âAvoid Passphrase Promptsâ section above.
Ensure you added the key as a âSigning Keyâ (not just Authentication)
Check the email in your commits matches your GitHub email:
git config --global user.email
Push commits and wait 30 seconds for GitHub to verify
Verify the key is still active in GitHub Settings â SSH and GPG keys
Hereâs what the relevant section should look like:
[user]
name = Your Name
email = your.email@example.com
signingkey = /Users/you/.ssh/id_rsa.pub
[commit]
gpgsign = true
[gpg]
format = ssh
Require signed commits via branch protection:
main (or your default branch)Now unsigned commits will be rejected on push.
Note: Make sure all collaborators have signing configured before enabling this, or they wonât be able to push.
This is like HTTPS was a decade agoâoptional until it wasnât. Organizations can require signed commits through branch protection rules. Security tools flag unsigned commits. And when supply chain attacks happen, signed commits are the only way to prove whatâs legitimate.
Youâre not setting this up for today. Youâre setting it up for when it matters.
Related:
Credits: Inspired by Nick Taylorâs article on GPG commit signing, adapted for the simpler SSH approach.