There is this nice feature from github to show that a git commit is signed using a gpg key.
I followed the following articles:
and I'm now able to sign my commits and tags using the command line by default.
(This is also visible/marked as "Verified" in the github repository)
However eclipse refuses to (properly) sign any git commit (with gpg) even if I turn on/off the "sign-off" button. It also doesn't show whether a commit was signed at all.
What am I doing wrong or is eclipse/egit not (yet) able to deal with gpg?
I use the following tools
To configure your Git client to sign commits by default for a local repository, in Git versions 2.0.0 and above, run git config commit.gpgsign true . To sign all commits by default in any local repository on your computer, run git config --global commit.gpgsign true .
It seems to be a missing feature of EGit, you should probably suggest this enhancement to http://bugs.eclipse.org .
That should be possible with Eclipse 2019-03 (three years later), which includes EGit 5.3.0.
EGit 5.3.0 can sign commits with GPG.
Note: EGit 5.3.0 requires Eclipse Neon (4.6) or better.
So you can test it in your Eclipse, as long as it is Neon or more recent.
The new icon in the upper right will allow you to toggle commit signing on or off.
The default is read from the Git configuration.
If the config optioncommit.gpgsign
is set totrue
, the button will be selected by default.
The value ofuser.signingkey
will be used to determine the signing key.
- If the value is unset, the email address of the committer will be used to lookup the key.
- If no key can be found a commit will fail.
Keys will be looked up from your GPG keyring (either
~/.gnupg/pubring.kbx
or~/.gnupg/secring.gpg
;
on Windows the directory%APPDATA%\gnupg
is used—if it exists—instead of~/.gnupg
).See the following GitHub help pages for help on GPG signing keys:
- Generating a new GPG key
- Telling Git about your signing key
- Associating an email with your GPG key
Update 2022:
Since EGit 5.11 (Eclipse 2021-03) you can
You can also automatically sign commits when you commit in Eclipse
The following worked for me:
Add your sign key (replace 0150436D9CD488B3
, see https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key how to find yours)
git config --global user.signingkey 0150436D9CD488B3
Add your GPG installation (replace the path):
git config --global gpg.program "C:\Program Files\Git\usr\bin\gpg.exe"
Set auto-sign to true:
git config --global commit.gpgsign = true
Now the "Sign Commit" toggle button is toggled by default:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With