looking for some solutions? You are welcome.

SOLVED: GPG sign Git commit on repository owned by root


I have a Git repository owned by the root user that I can access with sudo. Normally in order to use this repo with Git, I use sudo -E git .... The -E flag is necessary so that the Git within sudo inherits my default Git configuration such as author... etc.

I decided to try GPG signing of this repository, so I enabled the options.

> sudo -E git config user.email 'EMAIL' && sudo -E git config user.signingkey 'SIGNINGKEY' && sudo -E git config commit.gpgsign true && sudo -E git config tag.gpgsign true

However upon trying to do a commit:

> sudo -E git commit --allow-empty -m 'Test commit'

error: gpg failed to sign the data
fatal: failed to write commit object

However it does not appear that gpg can sign this repository with my GPG keys that exists in my user profile.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: