This guide will walk you through setting up GitHub with SSL authentication and GPG commit signing on Windows 11.
- Windows 11 computer
- Git installed
- GitHub account
- Initial Git Configuration
- SSH Key Setup
- Adding SSH Key to GitHub
- Testing SSH Connection
- GPG Setup for Commit Signing
- Configuring Git for GPG Signing
- Testing Signed Commits
- Troubleshooting
Configure Git with your credentials:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"Example:
git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"Open Command Prompt or PowerShell and run:
ssh-keygen -t ed25519 -C "your.email@example.com"Options during generation:
- File location: Press Enter (uses default location)
- Passphrase: Enter a passphrase or press Enter for no passphrase
type C:\Users\%USERNAME%\.ssh\id_ed25519.pubCopy the entire output (starts with ssh-ed25519).
- Go to GitHub SSH Settings
- Click "New SSH key"
- Title: Give it a descriptive name (e.g., "Windows 11 Laptop")
- Key type: Select "Authentication Key"
- Key: Paste your public key
- Click "Add SSH key"
Start-Service ssh-agent
ssh-add C:\Users\%USERNAME%\.ssh\id_ed25519ssh -T git@github.comExpected output:
Hi [your-username]! You've successfully authenticated, but GitHub does not provide shell access.
- Download from GnuPG website
- Install with default settings
- Open Kleopatra
- Click "New Key Pair"
- Select "Create a personal OpenPGP key pair"
- Fill in details:
- Name: Your full name
- Email: Same email as your Git configuration
- Click "Create"
- Set a passphrase (recommended)
- Right-click on your new key in Kleopatra
- Select "Export..."
- Save to a file or export to clipboard
- Copy the entire key content (from
-----BEGIN PGP PUBLIC KEY BLOCK-----to-----END PGP PUBLIC KEY BLOCK-----)
- Go to GitHub SSH and GPG Keys
- Click "New GPG key"
- Paste your exported public key
- Click "Add GPG key"
In Git Bash:
gpg --list-secret-keys --keyid-format=longOr with full path:
"C:/Program Files (x86)/GnuPG/bin/gpg.exe" --list-secret-keys --keyid-format=longExample output:
sec ed25519/1234567890ABCDEF 2025-09-07 [SC]
Your key ID is: 1234567890ABCDEF
git config --global user.signingkey YOUR_KEY_ID
git config --global commit.gpgsign true
git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe"Example:
git config --global user.signingkey 1234567890ABCDEF
git config --global commit.gpgsign true
git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe"git config --global --list | grep -E "(signingkey|gpgsign|gpg.program)"Expected output:
user.signingkey=1234567890ABCDEF
commit.gpgsign=true
gpg.program=C:/Program Files (x86)/GnuPG/bin/gpg.exe
cd /path/to/your/repo
git add .
git commit -m "Test signed commit"
git pushCheck your repository on GitHub - you should see a green "Verified" badge next to your commit.
Solution:
- Ensure SSH key is properly added to GitHub
- Test SSH connection:
ssh -T git@github.com - Check if SSH agent is running and key is loaded:
ssh-add -l
Possible causes and solutions:
-
Wrong key ID format:
git config --global user.signingkey YOUR_CORRECT_KEY_ID
-
GPG program not found:
git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe" -
Email mismatch between Git and GPG:
git config --global user.email "email@used.in.gpg.key"
Cause: Email in GPG key doesn't match Git committer email.
Solution:
# Check current Git email
git config --global user.email
# Update to match GPG key email
git config --global user.email "email@used.in.gpg.key"Start SSH agent service:
# In PowerShell as Administrator
Start-Service ssh-agent
Set-Service -Name ssh-agent -StartupType AutomaticIf GPG doesn't prompt for passphrase or fails silently:
- Install GPG Suite with GUI support
- Set GPG_TTY environment variable:
export GPG_TTY=$(tty)
Check SSH setup:
ssh -T git@github.comCheck GPG setup:
gpg --list-secret-keys --keyid-format=long
git config --global --list | grep gpgTest GPG signing:
echo "test" | gpg --clearsign# Generate SSH key
ssh-keygen -t ed25519 -C "email@example.com"
# Add to SSH agent
ssh-add ~/.ssh/id_ed25519
# Test connection
ssh -T git@github.com# List secret keys
gpg --list-secret-keys --keyid-format=long
# Test signing
echo "test" | gpg --clearsign# Basic setup
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# GPG setup
git config --global user.signingkey YOUR_KEY_ID
git config --global commit.gpgsign true
git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe"Note: Replace placeholder values like YOUR_KEY_ID, your.email@example.com, and file paths with your actual values.