gpg: signing failed: secret key not available
1 使用png签名tag时报错“
jb@39:~/11$ git tag -s gpg -m "gpg"
gpg: directory `/home/jb/.gnupg' created
gpg: new configuration file `/home/jb/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/jb/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/jb/.gnupg/secring.gpg' created
gpg: keyring `/home/jb/.gnupg/pubring.gpg' created
gpg: skipped "vipzrx <vipzrx@gmail.com>": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
error: unable to sign the tag
解决方法:
创建trustdb.gpg
$ gpg --list-key
gpg: /home/jb/.gnupg/trustdb.gpg: trustdb created
$ gpg --list-key
显示为空,因为之前没有创建过gpg key
创建gpg key
$ gpg --gen-key
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? =========================》 回车
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (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
You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name: vipzrx
Email address: vipzrx@gmail.com
Comment: vipzrx-comment
You selected this USER-ID:
"vipzrx (vipzrx-comment) <vipzrx@gmail.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? ========================》 o
You need a Passphrase to protect your secret key.
====================================================================》这里输入密码
We need to generate a lot of random bytes. It is a good idea to perform
会需要很长很长时间
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need 268 more bytes)
+++++
....+++++
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need 72 more bytes)
................+++++
Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need 112 more bytes)
....+++++
gpg: key ACD99A24 marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
pub 2048R/ACD99A24 2013-11-28
Key fingerprint = 601E E55C 7B9D 9E3C 4A9F 64AA 12FF A237 ACD9 9A24
uid vipzrx (vipzrx-comment) <vipzrx@gmail.com>
sub 2048R/41A14E55 2013-11-28
创建gpg key是否成功?
$ gpg --list-key
/home/jb/.gnupg/pubring.gpg
---------------------------
pub 2048R/ACD99A24 2013-11-28
uid vipzrx (vipzrx-comment) <vipzrx@gmail.com>
sub 2048R/41A14E55 2013-11-28
重新提交gpg签名的tag
jb@39:~/11$ git tag -s gpg-add -m "gpg-add" -u vipzrx
You need a passphrase to unlock the secret key for
user: "vipzrx (vipzrx-comment) <vipzrx@gmail.com>"
2048-bit RSA key, ID ACD99A24, created 2013-11-28
这时会弹出
输入创建该gpg key时,设置的保护gpg的密钥
密钥输对之后,成功执行,会返回$