Use GPG4Win Instead of Git's Internal GPG on Windows

Viewed 730

When I run gpg --list-secret-keys --keyid-format LONG within git I get no display of keys at all. On the other hand, when I run the same command in cmd or PowerShell I get an output that looks like

enter image description here

I also added the gpg.program config in the global config file by running git config --global gpg.program "/c/Program Files (x86)/GnuPG/bin/gpg.exe". To no avail. Any idea what I could be doing wrong? As a side note, I am only using git bash and have not integrated git into windows.

1 Answers

I ended up figuring out how to use GPG4Win in Git Bash

  1. Check if GPG4Win is in your windows path variable

    • You can do this following this tutorial linked here.
    • Look for a line in the System variables PATH that looks like this enter image description here
    • If not go ahead and add it
  2. Add gpg.program into git config

    • You can do this by running git config --global gpg.program gpg. This will make sure it is using the system installed gpg program.
  3. Remove gpg related commands from git install

    • In order to do this you have to go to this path C:\Program Files\Git\usr\bin
    • From there look for all of the .exe files that start with gpg and go ahead and remove them. For this step, you most likely will need administrative permissions.

That is it you should now be able to restart git bash and view all of your keys or add keys to the windows installed gpg program.

Related