我阅读了关于pretty属性在Git 2.10版本发布说明中的几篇文章。通过阅读这些文章,将git升级到2.10.0,并对全局.gitconfig
进行了更改,结果如下 -
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[user]
name = xyz
email = abc.def@gmail.com
signingkey = AAAAAAA
[core]
excludesfile = /Users/xyz/.gitignore_global
editor = 'subl' --wait
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[color "diff"]
old = red strike
new = green italic
但现在我尝试使用签署我的提交的方式
git commit -a -S -m "message"
我看到了以下错误信息 -
注意 - 我仍然可以使用您需要输入密码来解锁用户“XYZ(数字签名)”的秘密密钥
2048位RSA密钥,ID为AAAAAAAA,创建于2016年07月01日
错误:gpg无法签署数据致命错误:无法编写提交对象
git commit -a -m“message”
提交更改
有没有办法克服这个问题?或者需要在gpg
配置中进行任何更改以适应git的升级?
更新 1
在阅读Is there a way to "autosign" commits in Git with a GPG key?之后,我希望进一步提高其实用性。我已经使用配置了密钥。
git config --global user.signingkey ED5CDE14(with my key)
git config --global commit.gpgsign true
很明显,无论如何都会出现相同的错误。
user.signingkey
解决了我的问题,很奇怪。 - Xavier Hogpgconf --kill gpg-agent
命令,详情请见此处讨论。 - Lounge9git config --get-all user.name
和git config --get-all user.email
与用于签名的密钥相同,可以通过gpg -K --keyid-format SHORT
进行检查。 - Max Vorobjev