Mac 端 VS Code 提交代码失败 error: gpg failed to sign the data

问题现象 1:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
error: cannot run gpg: No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object

注意,此处有明显错误提示 error: cannot run gpg: No such file or directory

解决办法:

git config --global gpg.program "$(which gpg)"
echo "no-tty" >> ~/.gnupg/gpg.conf

问题现象 2:

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

对于这种没有明显错误提示的提交异常,只能采用类似于 gpg debug 的方式

解决办法:

  1. gpg --version
  2. echo "test" | gpg --clearsignclearsign error
  3. 执行 brew install gnupg gnupg2 pinentry-mac
  4. 然后继续尝试 echo "test" | gpg --clearsign ,并输入 mac 开机密码,非 gpg 密码
  5. 这时commit就可以带上gpg签名了signed successfully
  6. git commit -S -m "This is a test commit with gpg signing"

最后查看下本地的 git 环境配置

git config -l | grep gpg
git config

客官慢走,有空常来啊😄
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇