GPG实际使用问题

1.gpg: Can't check signature: public key not found错误的解决方法
nwpushuai@nwpushuai:~/Sources/temp/temp$ repo init
Get http://××××××××:×××/repo/test-repo
remote: Counting objects: 73, done
remote: Finding sources: 100% (73/73)
remote: Total 73 (delta 8), reused 73 (delta 8)
Unpacking objects: 100% (73/73), done.
From http://××××××××:×××/repo/test-repo
* [new branch]      master     -> origin/master
* [new tag]         v1.0       -> v1.0
object 8cbb175b29ef332a1372c6bdaa0cfe670cd40f69
type commit
tag v1.0
tagger nwpushuai <××××××××:×××> 1520607250 +0800
add gpg
gpg: Signature made 2018年03月09日 星期五 22时54分10秒 CST using RSA key ID ××××××××
gpg: Can't check signature: public key not found
error: could not verify the tag 'v1.0


出错原因是曾使用repo sync从其它库sync过代码,删掉~/.repoconfig即可:
nwpushuai@nwpushuai:~/Sources/temp/temp$ repo init
gpg: keyring `/home/nwpushuai/.repoconfig/gnupg/secring.gpg' created
gpg: keyring `/home/nwpushuai/.repoconfig/gnupg/pubring.gpg' created
gpg: /home/nwpushuai/.repoconfig/gnupg/trustdb.gpg: trustdb created
gpg: key 920F5C65: public key "Repo Maintainer <repo@android.kernel.org>" imported
gpg: key 692B382C: public key "Conley Owens <cco3@android.com>" imported
gpg: key ××××××××: public key "nwpushuai (nwpushuai is a secret) <××××××××:×××>" imported
gpg: Total number processed: 3
gpg:               imported: 3  (RSA: 2)
Get http://××××××××:×××/repo/test-repo
remote: Counting objects: 73, done
remote: Finding sources: 100% (73/73)
remote: Total 73 (delta 8), reused 73 (delta 8)
Unpacking objects: 100% (73/73), done.
From http://××××××××:×××/repo/test-repo
* [new branch]      master     -> origin/master
* [new tag]         v1.0       -> v1.0
fatal: manifest url (-u) is required.




2. gpg: skipped "xxx": secret key not available的一种解决方法
问题描述:
gpgskipped "xxx": secret key not availablegpgsigning failed: No secret keyerrorgpg failed to sign the tagerrorunable to sign the tag

原因:未配置user.signingkey
解决办法:git config --global user.signingkey <GPG-key-id>

使用gpg –list-keys
nwpushuai@nwpushuai:~/Sources/Android/temp/testhhh$ gpg --list-keys
/home/nwpushuai/.gnupg/pubring.gpg
----------------------------------
pub   4096R/×××××××× 2018-02-11
uid                  nwpushuai (nwpushuai is a secret) <××××××××>
sub   4096R/×××××××× 2018-02-11

   signingkey为××××××××

3.gpg签名tag

git tag -u "A4A32896" -s v0.12 -m "signed version 0.2 released" 52dd2


配置gitconfig
           git config user.signingkey ××××××××

   Windows如果没有把gpg加进环境变量,还需要执行配置gpg.program的位置:          git config –global gpg.program “gpg路径”     示例:git config –global gpg.program “C:\Program Files (x86)\GNU\GnuPG\gpg2.exe” 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值