gpg failed to sign the data fatal: failed to write commit object [Git 2.10.0]

前端 未结 30 2002
难免孤独
难免孤独 2020-11-27 23:55

I followed few articles over the pretty attributes on Git 2.10 release note. Going through which upgraded the git to 2.10.0 and made changes to global .gitconfig

30条回答
  •  粉色の甜心
    2020-11-28 00:31

    To anybody who is facing this issue on MacOS machines, try this:

    1. brew uninstall gpg
    2. brew install gpg2
    3. brew install pinentry-mac (if needed)
    4. gpg --full-generate-key Create a key by using an algorithm.
    5. Get generated key by executing: gpg --list-keys
    6. Set the key here git config --global user.signingkey
    7. git config --global gpg.program /usr/local/bin/gpg
    8. git config --global commit.gpgsign true
    9. If you want to export your Key to GitHub then: gpg --armor --export and add this key to GitHub at GPG keys: https://github.com/settings/keys (with START and END line included)

    If the issue still exists:

    test -r ~/.bash_profile && echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile

    echo 'export GPG_TTY=$(tty)' >> ~/.profile

    If the issue still exists:

    Install https://gpgtools.org and sign the key that you used by pressing Sign from the menu bar: Key->Sign

    If the issue still exists:

    Go to: ‎⁨your global .gitconfig file which in my case is at: ‎⁨/Users/gent/.gitconfig And modify the .gitconfig file (please make sure Email and Name are the same with the one that you have created while generating the Key):

    [user]
    	email = gent@youremail.com
    	name = Gent
    	signingkey = 
    [gpg]
    	program = /usr/local/bin/gpg
    [commit]
    	gpsign = true
    	gpgsign = true
    [filter "lfs"]
    	process = git-lfs filter-process
    	required = true
    	clean = git-lfs clean -- %f
    	smudge = git-lfs smudge -- %f
    [credential]
    	helper = osxkeychain

提交回复
热议问题