为什么源树在我尚未配置签名时寻找 gpg 密钥?

Goj*_*e87 3 git gnupg sourcetree

我在 Mac 上下载了sourcetree 应用程序,并向其中添加了本地 git 存储库。每当我尝试隐藏某些内容或提交某些内容时,sourcetree 都会抛出与 gpg 相关的错误。错误示例如下。

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree stash save test-stash 
/Applications/SourceTree.app/Contents/Resources/bin/gpg: line 2: gpg2: command not found
error: gpg failed to sign the data
Cannot save the current index state
Completed with errors, see above
Run Code Online (Sandbox Code Playgroud)

我无法找出此错误的原因。据我记得,我还没有为任何类型的签名配置项目或 sourcetree 应用程序。

如果您能帮助我解决此问题,那将会有很大帮助。

Goj*_*e87 5

即使我尝试从命令行提交,它也会要求 gpg 密钥。

经过在互联网上进行更多搜索后,我找到了根本原因。这是由于其中一个点文件将签名提交的全局配置设置为~/.gitconfigtrue。因此,我使用以下命令将配置设置回 false。

$ git config --global commit.gpgsign false
Run Code Online (Sandbox Code Playgroud)

唷!现在问题已经解决了...