You try git reset --hard but Git throws an error because the commit is signed and your setup has drifted. The repo is a mess, and your keychain feels locked against you. This is when muscle memory meets the reality of GPG and Git integration.
Understanding GPG in Git
Git doesn’t care about your GPG key until you tell it to. But once you enable commit signing with git config --global commit.gpgsign true, every commit you make is tied to the key. This works until the key expires, changes, or lives in a different environment than your terminal expects. At that point, even rollback can be painful.
When you run git reset—soft, mixed, or hard—you’re not rewriting keys. You’re moving HEAD to a new commit. But when commits are signed, those signatures can break automation or CI pipelines expecting GPG-verified changes. If the GPG environment variables or gpg-agent configuration are wrong, even amending commits can explode into error messages like:
gpg: signing failed: No secret key
gpg: signing failed: Invalid secret key
Common Fixes Before a Reset
- Check Your Keys
gpg --list-secret-keys --keyid-format=long
Match the key ID with git config user.signingkey.
- Kill and Restart the Agent
gpgconf --kill gpg-agent
gpg-agent --daemon
- Disable Signing Temporarily
If your goal is just to reset and push: