Automatic Git GPG Signing

This guide covers how to sign your Git commits with GPG automatically when using Cygwin on Windows. The goal is to avoid typing the password repetitively even when Cygwin does not provide the gpg-agent.

What is Git GPG Signing?

Git supports an extra security layer:

If you are a GitHub user you can read their guide on GPG signing here:

I will not dive into detail describing what GPG signing is and why you want it, but in short you want this feature.

Automating the Process

Setting up basic GPG signing is pretty easy. Once you have got that covered you will want to automate signing so that it happens automatically. The following configuration commands will make sure you sign all commits always:

  • git config –global commit.gpgSign true
  • git config –global user.signingkey YourSigningKeyHere

This however means you will have to type your GPG key password every time you can commit something. That quickly gets boring. Using a key agent seems to be the way to go.

Cygwin lacks a GPG Agent

If you are a Windows Cygwin user like me you will bump into the unfortunate situation where no key agent is available to help you. Key agents are great. I personally use KeePass. But KeePass does not support GPG keys and Cygwin does not offer a packaged solution either.

Solution by Proxy

To solve this problem I whipped up the following solution:

  • git config –global gpg.program /home/Olof/

And this is what looks like:

The solution is ugly and a bit insecure but gets the job done. We make use of the git configuration option “gpg.program” to proxy the gpg executable. The proxy supplies the password.


The downside with this solution is that you store your GPG password in clear text in a file on your hard drive. So if you do make use of this solution you should make sure to use that specific GPG key for this purpose only.

I tried finding a way to embed the password inside KeePass but gave up after a couple of hours. This insecure solution will have to do for now.

By | 2016-04-11T11:30:58+00:00 April 11th, 2016|Uncategorized|0 Comments

Leave A Comment