我刚开始使用git,我通过自制软件安装git和gpg。 由于某种原因,当我提交git时,我得到了这个错误 我看了很多关于这个话题的stackoverflow问题,但没有一个对我有用。 如何修复此错误以成功上传?
error: gpg failed to sign the data
fatal: failed to write commit object
我刚开始使用git,我通过自制软件安装git和gpg。 由于某种原因,当我提交git时,我得到了这个错误 我看了很多关于这个话题的stackoverflow问题,但没有一个对我有用。 如何修复此错误以成功上传?
error: gpg failed to sign the data
fatal: failed to write commit object
当前回答
如果你之前已经安装了pinentry和gpg,它突然就不工作了:
检查你的gpg是否正常工作:
echo "test" | gpg --clearsign
如果它说gpg: signing failed: No pinentry, 只需重新启动GPG守护进程客户端,它会不时卡住:
gpgconf --kill gpg-agent
现在它应该工作了:
echo "test" | gpg --clearsign
其他回答
如果它曾经工作,只是声明失败,杀死代理,再试一次:
gpgconf --kill gpg-agent
检查代理是否再次启动:
echo "test" | gpg --clearsign
我在升级到gnupg 2.x后遇到了这个问题。可以看到gpg2以不同的方式引用键:在~/.gitconfig中仍然有signingkey = ABC98F11 (gpg v1设置)。gpg2的键标识符较长。用gpg -list-secret-keys查找
可能你的Git配置设置为gpgsign = true。如果你不想指定你的提交,试着把它设置为false。转到存储库文件夹并更改该文件
纳米git -配置。
从这个……
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@bitbucket.org:yourrepo/project.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
signingkey = <GPG-KEY>
[commit]
gpgsign = true
这……
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@bitbucket.org:yourrepo/project.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
signingkey = <GPG-KEY>
[commit]
gpgsign = false
为我解决这个问题的方法是确保密钥的名称与我的git用户名匹配。我猜邮件也要匹配。这可能与我在Mac上使用GPG钥匙串有关。不确定。
当我填写这个时,我以为我是在命名密钥,但我猜它是在询问我的名字(git用户名)。
这将帮助你摆脱它
Git配置提交。gpgsign假