对于Linux / Mac,您可以使用gpg
。我从这里了解到如何做到这一点。我需要在以下命令前加上sudo
前缀。
Generate the keys
gpg --gen-key
Follow the defaults but enter your name and email and optionally a password.
List the keys.
gpg --list-keys
which should show something like this:
pub 2038R/91E83BF2 2017-05-13
uid Bob <name@example.com>
sub 2038R/E3872671 2017-05-13
Upload the public key to a keyserver
gpg --keyserver hkp://pool.sks-keyservers.net --send-keys PUBLIC_KEY_ID
replacing PUBLIC_KEY_ID
with your id (91E83BF2
in the example above).
Export your public and private keys to a text file
gpg -a --export name@example.com > public_key_sender.asc
gpg -a --export-secret-key name@example.com > private_key_sender.asc
Copy the contents of these files to Bintray at Edit Profile > GPG signing.
sudo
吗? - Suragchhkp://pool.sks-keyservers.net
时遇到了 "无法连接到主机" 的问题,但是我可以使用 hkp://ipv4.pool.sks-keyservers.net
进行推送。 - simbo1905我找到了解决方案,我需要在bintray中配置gpg签名。如果您还没有创建gpg密钥,请按照此教程操作:https://help.github.com/articles/generating-a-new-gpg-key/
在您创建gpg密钥之后,如果您不知道如何以加密形式复制私钥,请在git bash上执行以下步骤:
gpg --list-secret-keys
gpg --export-secret-keys --armor 您已复制的字符串 > private_key.asc
希望这可以帮助到您
这里有一个关于生成 gpg-key
的不错教程 https://help.github.com/articles/generating-a-new-gpg-key/
一些注意事项
-对于Ubuntu 14.04,我们需要使用gpg --gen-key
而不是gpg --full-generate-key
https://askubuntu.com/questions/1019793/how-to-solve-gpg-invalid-option-full-generate-key。
-用于生成私钥
gpg --armor --export-secret-keys {sec_value}
eg: gpg --armor --export-secret-keys 3AA5C34371567BD2
-当复制公钥或私钥时,请记得复制全部内容(包括-----BEGIN ...-----
和-----END ...-----
)