ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

使用git bash 生成GPG key和配置到idea

2022-08-05 11:04:29  阅读:124  来源: 互联网

标签:GPG -- gpg idea github git key wjwdive


查看git 版本

git --version
#2.31.1.windows.1

生成GPG key

gpg版本小于gpg (GnuPG) 2.1.17的使用命令:
$ gpg --full-generate-key
一般使用:
$ gpg --gen-key
按提示输入配置信息

Type of the key: RSA
Key size: at least 4096 bits
Key validity period: 1 year (it's a good practice to rotate the key once a year)
$ gpg --full-generate-key
gpg (GnuPG) 2.2.27-unknown; Copyright (C) 2021 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)
  (14) Existing key from card
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072) 4096
Requested keysize is 4096 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

创建用户id 一般和github 保持一致

GnuPG needs to construct a user ID to identify your key.

Real name: wjwdive
Email address: wjwdive@163.com
Comment: for github GPG key
You selected this USER-ID:
    "wjwdive (for github GPG key) <wjwdive@163.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

有一个过程

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.
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.
gpg: key 0000000000000000 marked as ultimately trusted
gpg: directory '/c/Users/Administrator/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/c/Users/Administrator/.gnupg/openpgp-revocs.d/0000000000000000000000000000000000000000.rev'
public and secret key created and signed.

pub   rsa4096 2022-08-05 [SC]
      0000000000000000000000000000000000000000
uid                      wjwdive (for github GPG key) <wjwdive@163.com>
sub   rsa4096 2022-08-05 [E]

查看GPG key

$ gpg --list-keys
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
/c/Users/Administrator/.gnupg/pubring.kbx
-----------------------------------------
pub   rsa4096 2022-08-05 [SC]
      0000000000000000000000000000000000000000
uid           [ultimate] wjwdive (for github GPG key) <wjwdive@163.com>
sub   rsa4096 2022-08-05 [E]

获取gpg key 公钥

$ gpg --armor --export 0000000000000000000000000000000000000000

github 里配置GPG key

IDEA 里配置,先重启IDEA

查看结果

标签:GPG,--,gpg,idea,github,git,key,wjwdive
来源: https://www.cnblogs.com/wjw-blog/p/16553534.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有