Git: Fixing GPG signing errors

I use GPG to sign Git tags. This is a list of signing errors I encountered and possible solutions. # Error: $ git tag --sign --message 'Release 2023.07.13' 2023.07.13 # --snip-- gpg: signing failed: No pinentry error: unable to sign the tag # Problem: # This can happen in a container if GPG cannot find a tool to ask the user for a passphrase. # https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html # Solution: dnf install pinentry # Error: $ git tag --sign --message 'Release 2023....

July 18, 2023

Git: Signing an already pushed commit

Given you have created a pull request (PR) with a single commit on GitHub. The commit is not GPG-signed. The maintainer asks you to sign the commit. If you are the only one working (committing) to this PR, you can force-push a signed commit. # Sign the latest commit on your local repository git commit --amend --no-edit --gpg-sign # Force push the commit to your remote repository (fork) git push --force-with-lease GitHub will automatically update your PR....

April 9, 2022

Git: Renaming tags

Be careful. Renaming tags might be difficult depending on your situation. There is no single step for renaming a tag. You must create a new tag with a new name and then delete the old tag. What you should know TLDR: When replacing tags, make sure that your new tag points to a commit object and not to an old tag object. Git has the following types of tags:...

December 12, 2021

Git: Deleting remote tags

Removing a remote tag: $ git push --delete <remote> <tag> $ git push --delete origin v1.0 Removing multiple remote tags: $ git push --delete <remote> <tag-1> <tag-2> <...> $ git push --delete origin v1.0

December 5, 2021