Skip to content

Instantly share code, notes, and snippets.

@MauricioKruijer
Created September 4, 2019 11:52
Show Gist options
  • Save MauricioKruijer/d9a6179cb95d5d513d334f8f5a3045a2 to your computer and use it in GitHub Desktop.
Save MauricioKruijer/d9a6179cb95d5d513d334f8f5a3045a2 to your computer and use it in GitHub Desktop.
Fixing signing commits gpg failed to sign the data fatal: failed to write commit object on macOS Mojave

Source: https://stackoverflow.com/questions/39494631/gpg-failed-to-sign-the-data-fatal-failed-to-write-commit-object-git-2-10-0

Auto-sign commits on MacOS (Globally and with different IDEs):

Get your signingkey in this way.

$ brew install gnupg gnupg2 pinentry-mac
$ git config --global user.signingkey <YOUR_SIGNING_KEY>
$ git config --global commit.gpgsign true
$ git config --global gpg.program gpg

Put the following in gpg.conf file (edit file with nano ~/.gnupg/gpg.conf command):

no-tty

Put the following in gpg-agent.conf file (edit file with nano ~/.gnupg/gpg-agent.conf command):

pinentry-program /usr/local/bin/pinentry-mac

Credits go to: Shayan Amani https://stackoverflow.com/a/47087248

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