SciTech-BigDataAIML-Github-Generating a new GPG key
Generating a new GPG key
Generating a new GPG key
If you don't have an existing GPG key, you can generate a new GPG key to use for signing commits and tags.
TOC(Table of Contents)
In this article
- Generating a GPG key
- Further reading
- Supported GPG key algorithms
GitHub supported several GPG key algorithms
If you try to add a key generated with an unsupported algorithm, you may encounter an error.
- RSA
- ElGamal
- DSA
- ECDH
- ECDSA
- EdDSA
Generating a GPG key
Note: Before generating a new GPG key, make sure you've verified your email address. If you haven't verified your email address, you won't be able to sign commits and tags with GPG. For more information, see "Verifying your email address."
Download and install the GPG command line tools command line tools for your operating system. We generally recommend installing the latest version for your operating system.
Open Terminal.
Generate a GPG key pair. Since there are multiple versions of GPG, you may need to consult the relevant man page to find the appropriate key generation command.
- If you are on version 2.1.17 or greater, paste the text below to generate a GPG key pair.
Shell :gpg --full-generate-key
- If you are not on version 2.1.17 or greater, the
gpg --full-generate-key
command doesn't work.
Paste the text below and skip to step 6.
Shell:gpg --default-new-key-algo rsa4096 --gen-key
- If you are on version 2.1.17 or greater, paste the text below to generate a GPG key pair.
At the prompt, specify
the kind of key
you want, or pressEnter
to accept thedefault
.At the prompt, specify
the key size
you want, or pressEnter
to accept thedefault
.Enter the
length of time
the key should be valid. PressEnter
to specify thedefault
selection, indicating that thekey doesn't expire
. Unless you require an expiration date, we recommend accepting this default.Verify that your selections are correct.
Enter your user ID information.
Note: When asked to enter your email address, ensure that you enter the verified email address for your GitHub account. To keep your email address private, use your GitHub-provided no-reply email address. For more information, see "Verifying your email address" and "Setting your commit email address."
Type a secure passphrase.
Use the
gpg --list-secret-keys --keyid-format=long
command,
to listthe long form of the GPG keys
,
for which you haveboth a public and private key
.
A private key
is required forsigning commits or tags
.
Shell:gpg --list-secret-keys --keyid-format=long
Note: Some GPG installations on Linux may require you to use gpg2 --list-keys --keyid-format LONG to view a list of your existing keys instead. In this case you will also need to configure Git to use gpg2 by running git config --global gpg.program gpg2.
From the list of GPG keys, copy the long form of the GPG key ID you'd like to use. In this example, the GPG key ID is 3AA5C34371567BD2:
Shell:$ gpg --list-secret-keys --keyid-format=long
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid Hubot <hubot@example.com>
ssb 4096R/4BB6D45482678BE3 2016-03-10
Paste the text below, substituting in the
GPG key ID
you'd like to use. In this example, the GPG key ID is3AA5C34371567BD2:
gpg --armor --export 3AA5C34371567BD2
# Prints the GPG key ID, in ASCII armor format
Copy your
GPG key
, beginning with-----BEGIN PGP PUBLIC KEY BLOCK-----
and ending with-----END PGP PUBLIC KEY BLOCK-----
.
Sample Interaction with gpg
:
**$ gpg --full-generate-key**
gpg (GnuPG) 2.2.40; Copyright (C) 2022 g10 Code GmbH
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
GnuPG needs to construct a user ID to identify your key.
Real name: Abael He
Email address: abaelhe@icloud.com
Comment:
You selected this USER-ID: "Abael He <abaelhe@icloud.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: /root/.gnupg/trustdb.gpg: trustdb created
gpg: directory '/root/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/root/.gnupg/openpgp-revocs.d/5E1A6E1D77B81072AD2AAC4AD2604453D5F3027D.rev'
**public and secret key created and signed**.
pub rsa4096 2024-09-27 [SC]
5E1A6E1D77B81072AD2AAC4AD2604453D5F3027D
uid Abael He <abaelhe@icloud.com>
sub rsa4096 2024-09-27 [E]
**$ gpg --list-secret-keys --keyid-format=long**
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
/root/.gnupg/pubring.kbx
------------------------
sec rsa4096/D2604453D5F3027D 2024-09-27 [SC]
5E1A6E1D77B81072AD2AAC4AD2604453D5F3027D
uid [ultimate] Abael He <abaelhe@icloud.com>
ssb rsa4096/2339955A5BFA7243 2024-09-27 [E]
**$ gpg --armor --export D2604453D5F3027D**
-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----
**$ gpg --armor --export D2604453D5F3027D > ~/gpg_rsa4096.pubkey**
SciTech-BigDataAIML-Github-Generating a new GPG key的更多相关文章
- github with msysgit:配置SSH Key
Step 1: Check for SSH keys First, we need to check for existing ssh keys on your computer. Open up G ...
- DIY的RPM包怎么签名呢 How to sign your custom RPM package with GPG key
https://gist.github.com/fernandoaleman/1376720 How to sign your custom RPM package with GPG key 这是文 ...
- Generating a new SSH key
Open Git Bash. Paste the text below, substituting in your GitHub email address. $ ssh-keygen -t rsa ...
- 多个github帐号的SSH key切换
写在前面的话 github账号,工作有一个,自己有一个.但是默认下使用ssh key在git push时只有默认账号能免输入账号和密码. 如果想让另一个账号在代码push时免账号和密码,请看这篇文章h ...
- Centos GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEYRetrieving key fro ...
- GPG key retrieval failed
Total size: 340 k Installed size: 1.2 M Is this ok [y/N]: y Downloading Packages: warning: rpmts_Hdr ...
- GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-
今天更新为163的源后,yum的时候报错:GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gp ...
- yum -y update 报错:GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
用的是centos6.5的镜像,yum源太老了,修改了之后想更新一下: yum -y update 执行报错: warning: rpmts_HdrFromFdno: Header V3 RSA/SH ...
- 多github帐号的SSH key切换
我有两个github帐号,一个是个人所用,一个是为公司项目所用.如果是单用户(single-user),很方便,默认拿id_rsa与你的github服务器的公钥对比:如果是多用户(multi-user ...
- rpm的gpg key
1 gpg 这是一种公钥.私钥机制. 2 rpm包的格式 rpm包由四部分构成,lead.signature.header和archive构成. 这里的签名(signature)是加密了的,也就是说, ...
随机推荐
- SpringBoot整合Web层技术
目录 1 SpringBoot整合Web层技术 1.1 SpringBoot整合Servlet 1.1.1 方式一 通过注解扫描完成Servlet组件的注册 1.1.1.1 创建Servlet 1.1 ...
- 代码随想录第二十天 | Leecode 235. 二叉搜索树的最近公共祖先 、 701.二叉搜索树中的插入操作 、450.删除二叉搜索树中的节点
Leecode 235. 二叉搜索树的最近公共祖先 题目描述 给定一个二叉搜索树, 找到该树中两个指定节点的最近公共祖先. 百度百科中最近公共祖先的定义为:"对于有根树 T 的两个结点 p. ...
- k8sd之pod生命周期
pod生命周期: 状态:pending 挂起 没有节点满足条件 running 运行 Failed sucess unkonwn pod生命周期中的重要行为: 初始化容器 容器探测:liveness ...
- codeup之日期类
Description 编写一个日期类,要求按xxxx-xx-xx 的格式输出日期,实现加一天的操作. Input 输入第一行表示测试用例的个数m,接下来m行每行有3个用空格隔开的整数,分别表示年月日 ...
- 自用----降重ai率方法
目录 自用----降重ai率方法 1.查重 2.降重 2.1 ai工具降重 2.2 ai降ai(参考他人blogs,没试过) 2.3 人工降重 处理步骤 具体内容 自用----降重ai率方法 1.查重 ...
- IntelliJ IDEA 设置代码自动补全不区分大小写
在使用IntelliJ IDEA进行开发时,输入一个关键字时会有提示相关的类和方法名,但是默认是区分大小写的,如何让IDEA不区分大小写呢? IntelliJ IDEA版本:IntelliJ IDEA ...
- 创建Spring Boot项目时,提示 Cannot download 'https://start.spring.io'
问题提出 在使用IDEA创建Spring Boot项目时,提示无法连接https://start.spring.io,内容如下: Cannot download 'https://start.spri ...
- HarmonyOS运动语音开发:如何让运动开始时的语音播报更温暖
鸿蒙核心技术##运动开发##Core Speech Kit(基础语音服务)# 前言 在运动类应用中,语音播报功能不仅可以提升用户体验,还能让运动过程更加生动有趣.想象一下,当你准备开始运动时,一个温暖 ...
- Golang defer
一.多个延迟执行语句的处理顺序 Go语言中defer语句会将起后面跟随的语句进行延迟处理,在defer归属的函数即将返回时,将延迟处理的语句按照defer的逆序进行执行,也就是说先被defer的语句最 ...
- C#学习日志
C#入门篇 EanoJiang/CSharp-: C#入门教程,自用 程序思维题: 两根不均匀的香,烧完一根是1h,怎么用来计时15min呢? 思路:一根香从两头同时点燃烧完是30min,只需再对半即 ...