gotOK 说到 Git,我有点菜鸟。所以我决定阅读 Scott Chacon 的 Pro Git。 BTW 好书,强烈推荐。

无论如何都到了有关签名标签的部分。
要使用 GPG 签署标签,您必须设置我所做的私钥。
但是,当我运行时:

git tag -s v1.6 -m "my signed 1.6 tag"

我得到以下信息:
C:\Users\Name\Desktop\git>git tag -s v1.6 -m "my signed 1.6 tag"
gpg: error loading `iconv.dll': The specified module could not be found.

gpg: please see http://www.gnupg.org/download/iconv.html for more information
gpg: skipped "Name <[email protected]>": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
error: unable to sign the tag

所以,我按照错误消息告诉我的去做,然后转到链接并按照说明进行操作。我将 iconv.dll 复制到包含 gpg.exe (\Git\bin) 的文件夹中。再次运行命令并得到:
C:\Users\Name\Desktop\git>git tag -s v1.6 -m "my signed 1.6 tag"
gpg: skipped "Name <[email protected]>": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
error: unable to sign the tag

编辑:

当我尝试列出我的 key 时,我收到此错误???
Name@NAME-PC ~
$ gpg --list-secret-keys
gpg: keyblock resource `c:/Users/Name/.gnupg\secring.gpg': file open error
gpg: keyblock resource `c:/Users/Name/.gnupg\pubring.gpg': file open error
gpg: fatal: c:/Users/Name/.gnupg: directory does not exist!
secmem usage: 0/0 bytes in 0/0 blocks of pool 0/32768

最佳答案

您可以使用 gpg GUI 初始化您的 gnupg 环境( key ),例如 gpg4win ,跟随 this tutorial ,或(更新)官方 gpg4win 文档“Gpg4win for Novices ”。

请注意,这个 blog post 添加了以下警告:



(注意:可能在 C:\Users\Name\AppData\Roaming\gnupg 上,目录名为 gnupg 而不是 .gnupg )


gpg --gen-key


cd C:\Users\Name
mkdir .gnupg
xcopy C:\Users\Name\AppData\Roaming\gnupg .gnupg


gpg: no writable public keyring found


signing failed: secret key not available

注意:一旦您的 gnupg 就位,如果您仍然有错误消息,请执行 add the the (gnupg) key-id you want to use when signing your tag :
git tag -u 'key-id' -s -m "some comment" some-tag

关于Git GPG 错误签名标签,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16876817/

10-15 03:29