本文介绍了Git错误 - gpg未能签署数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用git,我通过自制软件安装git和gpg。
出于某种原因,我得到这个错误,当我做 li>

  • brew install gnupg21 安装GnuPG 2.1

  • 保存的副本的原因〜/ .gnupg dir是GnuPG 2.1可能创建/更改一些不与GnuPG 2.0及更早版本向后兼容的关键数据,所以 if 你想要稍后再回来,你可以做 mv〜/ .gnupg〜/ .gnupg21&& mv〜/ .gnupg-GOOD〜/ .gnupg 。






    否则有一些基本的步骤来检查你是否有一个可用的GnuPG环境:


    • 运行 gpg2 -K --keyid-格式SHORT ,以检查您是否至少有一个密钥对



    如果输出显示给您没有密钥供GnuPG使用,那么你需要创建一个:




    • 运行 gpg2 --gen- key ,让GnuPG引导您完成创建密钥对的步骤






    如果您收到一条错误消息,提示设备不适用ioctl,请执行以下操作:


    • 运行导出GPG_TTY = $(tty)和/或将其添加到〜/ .bashrc 或〜/ .bash_profile


    I just started using git and I install git and gpg via homebrew.For some reason, I get this error when i do git commitI looked at so many other stackoverflow questions regarding this topic and none of them worked for me.How can I fix this error so that I can upload successfully.

    error: gpg failed to sign the data
    fatal: failed to write commit object
    
    解决方案

    For troubleshooting, two things to first try:

    • run git config --global gpg.program gpg2, to make sure git uses gpg2 and not gpg
    • run echo "test" | gpg2 --clearsign, to make sure gpg2 itself is working

    If that all looks all right, one next thing to try:

    • run brew install pinentry to ensure you have a good tool installed for passphrase entry

    If after that install and you re-try git commit and still get the "failed to sign the data" error:

    • run gpgconf --kill gpg-agent to kill any running agent that might be hung

    If that says gpgconf isn’t installed or doesn’t have a --kill option, you might try this:

    1. cp ~/.gnupg ~/.gnupg-GOOD to save a copy of your ~/.gnupg to revert to later if needed
    2. brew install gnupg21 to install GnuPG 2.1

    The reason for saving a copy of your ~/.gnupg dir is that GnuPG 2.1 potentially creates/changes some key data in way that isn’t backward-compatible with GnuPG 2.0 and earlier, so if you want to go back later, you can do mv ~/.gnupg ~/.gnupg21 && mv ~/.gnupg-GOOD ~/.gnupg.


    Otherwise there are some basic steps to run to check you’ve got a working GnuPG environment:

    • run gpg2 -K --keyid-format SHORT, to check that you have at least one key pair

    If the output of that shows you have no secret key for GnuPG to use, then you need to create one:

    • run gpg2 --gen-key, to have GnuPG walk you through the steps for creating a key pair

    If you get an error message saying "Inappropriate ioctl for device", do this:

    • run export GPG_TTY=$(tty) and/or add that to your ~/.bashrc or ˜/.bash_profile

    这篇关于Git错误 - gpg未能签署数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    07-22 17:19
    查看更多