Skip to content

Instantly share code, notes, and snippets.

@danoli3
Created December 27, 2023 19:39
Show Gist options
  • Save danoli3/5b39df59c10804e7f35aac25fd2a04ac to your computer and use it in GitHub Desktop.
Save danoli3/5b39df59c10804e7f35aac25fd2a04ac to your computer and use it in GitHub Desktop.
Setup GPG Windows to Sign Commits That Works!! With SourceTree Too
In gitbash:
PreReqs:
Git Bash: https://git-scm.com/download/win
WinGet - https://learn.microsoft.com/en-us/windows/package-manager/winget/
winget install GnuPG.GnuPG
gpg --version
gpg --default-new-key-algo rsa4096 --gen-key
OR
gpg --full-generate-key
gpg --list-secret-keys --keyid-format=long
Get the key and grab the short-key
#sec rsa4096/[short-key] 2024-12-12 [SC]
gpg --armor --export [short-key]
#upload the exported key to github
#configure gitconfig
git config --global user.signingkey [short-key]
git config --global commit.gpgsign true
git config --global gpg.program "C:/Program Files (x86)/gnupg/bin/gpg.exe"
#environment var Important - without this it will fail on commit -S
GNUPGHOME=%USERPROFILE%\.gnupg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment