簡體   English   中英

Git沒有問我gpg密碼短語而且我的提交失敗了

[英]Git does not ask me for gpg passphrase and fails my commit

當我執行git commit -a -S -m "Commit Message" ,我收到此錯誤:

You need a passphrase to unlock the secret key for
user: "Username (Gpg Key) <email-id>"
2048-bit RSA key, ID 2487BE7C, created 2016-10-03

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

但是,當我提交時,它甚至不會詢問/提示我的密碼。 那么,在使用gpg的-S標志時,如何以及在何處輸入我的密碼?

我有類似的事情。 我有gpg和gpg2二進制文件,都指向GPG版本2.0.30。 我沒有被提示輸入密碼。

在你的bash配置文件中(我在我的.zshrc文件中完成)添加以下行:

export GPG_TTY=$(tty)

它停止提示我,所以我不得不殺死守護進程

ps aux | grep gpg
mark              3129   0.0  0.0  4397952    820   ??  Ss    8Mar19   0:28.84 gpg-agent --homedir /Users/Mark/.gnupg --use-standard-socket --daemon
mark             18137   0.0  0.0  4286492    848 s000  R+    3:43pm   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn gpg

然后

sudo kill -9 3129

然后它奏效了。 這可能是一個稍微不同的問題。

如果您使用的是OSX。 似乎gpg更新(brew)更改為gpg到gpg1的位置,你可以更改git查找gpg的二進制文件:

git config --global gpg.program gpg1

請參閱此媒體博客文章

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM