Setting up a new computer this week ran me smack into a wall of not remembering how I got my GIT + GPG signing key working the 1 time I managed to get it working previously. After piecing together a few articles I am putting this consolidated article together to hope it helps someone else (or me next computer 🙂 )
Download and Install GPG4Win:
https://gpg4win.org/get-gpg4win.html
You do not need anything besides the base GPG tools, none of the service stuff.
Install Git For Windows:
https://gitforwindows.org/
This gives you a *nix based shell, this software is a bundle with latest version of Git which use MINGW environment, a Git bash shell, a Git GUI and an extension for Windows Explorer shell (Make sure your local version of Git is at least 2.0, otherwise Git don’t have support for automatically sign your commits)
Importing Old Keys:
Once GPG is installed, you can pull in your private key that you previously had:gpg --import <PRIVATE-KEY>
Remember to wrap the private key argument in quotes if your path has a space in it. You should be prompted for your passphrase for the key. Once that is complete you should be able to see the keys by running (we want the long format for later use):gpg --list-secret-keys --keyid-format LONG
Example output:$ gpg --list-secret-keys --keyid-format LONG
/c/Users/jaudet/.gnupg/pubring.gpg
sec rsa4096/12345678ABCDEF 2020-04-17 [SC]
uid [ultimate] Joe Audet joe@joeaudet.com
ssb rsa4096/01964857563FGF 2020-04-17 [E]
Trust Key ( https://www.gnupg.org/gph/en/manual/x334.html )gpg --edit-key 12345678ABCDEF
trust
Select a trust level (Since I made the key I went with 5 or ultimate, use caution when trusting others keys)
Setup GIT Global parameters
In GIT Bash, execute the following commands (the username and email must match what was used in github):git config --global user.name "username"
git config --global user.email "email"git config --global gpg.program "C:/Program Files/Git/usr/bin/gpg.exe"
git config --global user.signingkey
12345678ABCDEF
git config --global commit.gpgsign true