Skip to content

Instantly share code, notes, and snippets.

@creachadair
Created May 26, 2019 23:42
Show Gist options
  • Select an option

  • Save creachadair/fd1b8e41210aaefa1fd602897ddc7998 to your computer and use it in GitHub Desktop.

Select an option

Save creachadair/fd1b8e41210aaefa1fd602897ddc7998 to your computer and use it in GitHub Desktop.
Signing git tags with gnupg

To cryptographically sign a tag, you need to have gpg installed and either have a secret key matching your configured user/e-mail, or define user.signingkey in the git config for your repository.

Assuming you have done this, write

git tag -s -m "description" tagname

This may still fail if gpg is unable to figure out how to prompt you for your passphrase. In that case, verify that gpg-agent is running, and that GPG_TTY is set correctly. You should be able to use:

export GPG_TTY=$(tty)

Failing this the symptom will be an error diagnostic like

error: gpg failed to sign the data
error: unable to sign the tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment