Both DCO sign-off and GPG signature signed commits are required for all pull requests to be merged successfully.
This guide makes it as easy as possible for you to set up your GPG key and DCO and GPG sign your commits.
- Commit Signing Guidelines (DCO + GPG)
- Definitions
- Step-by-Step Setup
- Final Checklist
- Fixing Unsigned Commits
- Rebasing and Signing
- Still Need Help?
| Signature | Flag | Purpose | GitHub Check |
|---|---|---|---|
| DCO Sign-off | -s |
Confirms legal right to contribute code (required by CI bot). | DCO Check |
| GPG Signature | -S |
Proves you are the author of the commit (required by CI bot, requires GPG setup). | Verified Badge |
CRITICAL WARNING: To pass the DCO check and achieve the "Verified" status, all commits must be signed using both the -S and -s flags together.
If you don't already have a GPG key:
gpg --full-generate-keyChoose:
- Kind: ECC (sign and encrypt) default
- Elliptic curve: Curve 25519 default
- Expiration: 0 default (does not expire)
- Name, Email: Must match your GitHub email
- Passphrase: Set a strong passphrase that you'll need to remember
Learn more GPG key set-up documentation on GitHub
Once created, list your keys:
gpg --list-secret-keys --keyid-format LONGCopy the key ID (looks like 34AA6DBC).
Export your GPG public key:
gpg --armor --export YOUR_KEY_IDPaste the output into GitHub:
git config --global user.signingkey YOUR_KEY_ID
git config --global commit.gpgsign trueAll commits must be signed using both DCO and GPG. Each time you create a commit, use -S and -s flags like this:
git commit -S -s -m "chore: your commit message"-S= GPG sign-s= DCO sign-off
⚠️ Ensure every commit in your branch follows this rule.
To check that your commits are signed correctly:
git log --show-signature- Ensure each commit shows both GPG verified and DCO signed-off.
For a quick check of recent n commits: Note how many commits you have added, and replace 5 with that.
git log -n 5 --pretty=format:'%h %an %G? %s'Legend:
- G = Good (valid signature - you want to see
G) - B = Bad (invalid signature)
- U = Unknown (not signed)
- E = Signed (but not verifiable locally)
- All commits signed with
-S. - DCO added with
-s - GPG key added to GitHub
If you accidentally forgot to sign commits, there are two ways to fix them:
Soft revert the impacted commits while keeping changes locally:
git reset --soft HEAD~nHEAD~n= number of commits to go back- Example: To fix the last 3 commits:
git reset --soft HEAD~3
Then, recommit each commit with proper signing:
git commit -S -s -m "chore: your commit message"Alternatively, you can amend commits retroactively:
git commit --amend -S -s
git rebase -i HEAD~n # For multiple commits
git push --force-with-leaseThis is difficult and you may run into problems, for example, if you have merged from main.
Rebase operations will be required when your branch is behind the upstream main. We do not recommend merging from main, rebasing is strongly suggested. See Rebasing Guide for instructions on how to keep your main branch up to date and how to rebase.
When rebasing, you must use this command to ensure your commits remain DCO and GPG signed:
git rebase main -SNote:
git push --force-with-leasesafely updates the remote branch without overwriting others' changes.
- Refer to GitHub's GPG Docs
- Ask on the Hiero Discord