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的一种解决方法
问题描述:
gpg: skipped "xxx": secret key not availablegpg: signing failed: No secret keyerror: gpg failed to sign the tagerror: unable 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”