Skip to content

Instantly share code, notes, and snippets.

@danielcshn
Created June 24, 2022 03:14
Show Gist options
  • Save danielcshn/cbedfe468bc16c9697ded40aaf7587ec to your computer and use it in GitHub Desktop.
Save danielcshn/cbedfe468bc16c9697ded40aaf7587ec to your computer and use it in GitHub Desktop.
GPG signing with Git and Github Desktop (Windows)

Hi Github users,

You can now signed your commits on Github using at least Git v2.33.0 and Github Desktop 3.0.2.

  1. Install GnuPG (Gpg4win): https://gnupg.org/download/index.html

  2. Generate a GPG key and add it to Github: https://help.github.com/articles/generating-a-new-gpg-key (if you don't want to type a passphrase on every commit, you need to press "Enter" when the console will prompt you to type a passphrase)

  3. Configure Git properly by editing the .gitconfig file using the command line git config --global --edit in a terminal or edit manually (C:\Users\%username%\.gitconfig), then replace YOUR_USERNAME, YOUR_GITHUB_EMAIL and YOUR_SIGNING_KEY with your data

[user]
	name = YOUR_USERNAME
	email = YOUR_GITHUB_EMAIL
	signingkey = YOUR_SIGNING_KEY
[gpg]
	program = "C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe"
[commit]
	gpgsign = true
  1. Enjoy signed commits with your favorite code editor!

Note that you can temporary disable GPG signed commits by setting gpgsign = false in your .gitconfig file with git config --global commit.gpgsign false

That's all! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment