gittag :gpg: skipped “xxx@xxx“: secret key not available

it2023-03-16  80

 

最近发生件奇怪的事,我的git管理,clone,add,commit 都可以。但是git tag 时候就报错:git  tag   :gpg: skipped "xxx@xxx": secret key not available。网上找了很久找到办法记录下:

https://stackoverflow.com/questions/12061645/generating-a-gpg-key-for-%20git-tagging

1、首先运行下面命令

$ gpg --list-key

运行完了发现什么都没用,原来是我没有gpg key,那就创建下

$ gpg --gen-key gpg (GnuPG) 2.0.14; Copyright (C) 2009 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) Your selection? 1 RSA keys may be between 1024 and 4096 bits long. What keysize do you want? (2048)

 我选择了第一个类型,问你要多大长度,根据提示输入了2048.

Requested keysize is 2048 bits Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y

key 选择0,输入y确认,

 

GnuPG needs to construct a user ID to identify your key. Real name: xxx Email address: xxx@example.com Comment: gpg for xxx

分别输入 real name,email  comment  .

然后按要求输入密码。直接回车就好,和创建git-key 类似。

最后再次输入git tag -s v1.0  -m"xxxx" 终于可以了。

 

补充:

过了一段时间发现问题又出现了:

继续输入gpg --list-key  发现key是存在的,此时需要对key从先签入。

signingkey为908F90A5

执行命令:

git config user.signingkey 908F90A5

终于又正常了

最新回复(0)