Skip to content

Instantly share code, notes, and snippets.

@DeVoresyah
Created January 15, 2020 08:24
Show Gist options
  • Save DeVoresyah/c2399ade99ace978789b6a2c21cfb109 to your computer and use it in GitHub Desktop.
Save DeVoresyah/c2399ade99ace978789b6a2c21cfb109 to your computer and use it in GitHub Desktop.
Setup GPG Signed Key (Mac & Linux)

First Step

Follow official instruction from this GitLab article : https://gitlab.com/help/user/project/repository/gpg_signed_commits/index.md

Linux

based on my experience, if you're linux user I think that step is enough

Mac

if you get error like this

fatal: failed to write commit object```

then you might follow optional step:
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```

You might need to execute `killall gpg-agent` command after editing the configurations file, `gpg.conf`, according to the comments. As the self-explanatory command says, this command will terminate the GPG (Gnu Privacy Guard) agent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment