Using Mac OS X Yosemite (10.10), I cannot active GnuPG-signing of commits in SourceTree, as the checkbox is disabled. How can I enable commit-signing?
You likely aren't pointing the GPG Program setting (found in SourceTree -> Preferences -> Advanced) at the right bin. If you're using GPGTools on OS X, it should be /usr/local/MacGPG2/bin
. To navigate to the /usr/bin
directory in the Open File dialog, click shift + command + g
If you installed gnupg
with Homebrew, see @chakming`s answer in the comments below.
git config --global gpg.program gpg2
). In SourceTree I have to specify /usr/local/bin
in the GPG Program field. –
Thereabout brew install gnupg
, try to locate gng by ls -la /usr/local/bin/gpg
and you will see the version: ../Cellar/gnupg/2.2.6/bin/
, then open terminal and go /usr/local/Cellar/gnupg/2.2.6/bin/
, then create a shortcut by ln -s gpg gpg2
. Go to SourceTree -> Preferences and use /usr/local/Cellar/gnupg/2.2.6/bin
as you GPG Program location then everything works fine –
Bili which gpg
. Thanks! –
Variegate usr/local/bin
directory: ln -s /usr/local/bin/gpg /usr/local/bin/gpg2
–
Mccorkle system
git and not the embedded
git since sourcetree was looking for gpg2
. That didn't work. I switched back to use the embedded
git and made a symlink as commented before: n -s gpg gpg2
. That worked. –
Umiak Since SourceTree version 1.8.1, that checkbox will also be disabled if you had no GPG key when SourceTree was started. Creating your first GPG key while SourceTree is still running won't help. You will need to restart SourceTree in order for it to notice that you now have GPG keys.
Although techpeace's answer seems to have resolved it for BJ Myers, there is also another possible reason for the option to remain greyed out despite correcting the setting.
If your keyring has been around for a while (close to 20 years in my case), chances are that some debris has piled up in one corner or another of the trust database. The tricky bit is that in most cases this doesn't show up in obvious ways, i.e. you can still sign, verify, encrypt, and decrypt stuff just fine. It's just that spurious keyid_from_fingerprint: no pubkey
or public key of ultimately trusted key 00000000 not found
that shows up from time to time (typically when using some keyring management front-end).
And this trustdb inconsistency was what prevented SourceTree from enabling the commit signing options in my case.
The solution is straightforward; simply follow Spike's instructions for weeding out 00000000 keys from the trustdb. Spike talks about one 00000000 entry, but in my case there were several. Just remove them all. Takes less than 5 minutes, and works like a charm.
To set up Sourcetree to sign with GPG:
- Install gnupg:
brew install gnupg
- I found that gnupg was installed in
/opt/homebrew/Cellar/gnupg/2.3.6/bin
(note2.3.6
might be different for you, and /opt/homebrew is for ARM macs, brew installs to/usr/local/bin
on intel macs)
- I found that gnupg was installed in
- Ran
ln -s gpg gpg2
(as per a comment in another answer) - Went into Sourcetree preferences (Command + , > Advanced > GPG Program)
- Pressed Shift + Command + G and pasted the path from earlier:
/opt/homebrew/Cellar/gnupg/2.3.6/bin
.
- Pressed Shift + Command + G and pasted the path from earlier:
In SourceTree mac menubar > Repository > Repository settings > Security tab, enabled the checkbox: enable GPG key signing for commits
© 2022 - 2024 — McMap. All rights reserved.
GPG Program:
should point to MacGPGs's bin directory and not thegpg
binary itself – Bolshevist