Please make sure you have the correct access rights and the repository exists.
在使用git命令的过程中,出现如下提示:Please make sure you have the correct access rightsand the repository exists.造成此结果多半是未在GitHub中添加SSH key(添加公钥)。拓展1.SSH简介SSH:是Secure Shell(安全外壳协议)的缩写,建立在应用层和传输层基础上的安全协议。...
在使用git命令的过程中,出现如下提示:
Please make sure you have the correct access rights
and the repository exists.
造成此结果多半是未在GitHub中添加SSH key(添加公钥)。
拓展
1.SSH简介
SSH:是Secure Shell(安全外壳协议)的缩写,建立在应用层和传输层基础上的安全协议。
SSH 密钥可以让使用者方便的登录到 SSH 服务器,而无需输入密码。SSH 密钥对总是成双出现,一把公钥,一把私钥。公钥可自由存放在所需要连接的 SSH 服务器上,而私钥当然得保管好。
2.公钥私钥
ssh-keygen命令,可以生成公钥和私钥,默认生成到用户目录下的.ssh文件夹里面(以RSA为例)
私钥默认会被保存在 ~/.ssh/id_rsa
公钥默认会被保存在 ~/.ssh/id_rsa.pub
解决方法
步骤1.生成密钥对
ssh-keygen -f fileName -t rsa -C "xxx@example.com"
参数解析:
-f 指定要生成文件的文件名称【output_keyfile:输出密钥文件】,可省略此项设置生成默认文件
-t 设置认定方式,值为rsa,即非对称加密;或dsa,即数字签名和认证
-c 指定公钥中的备注信息 (可设GitHub账户名或其它信息)
如果执行成功。返回【此处username为电脑上用户名】
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/username/.ssh/id_rsa):
可多次按回车直到出现如下返回
Your identification has been saved in /c/Users/username/.ssh/id_rsa.
Your public key has been saved in /c/Users/username/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:r5/ZLjJHYcpVxrqoU6qNWa5Uui720ZNaiR6SiPbynFI beizhuxinxi
The key's randomart image is:
+---[RSA 3072]----+
| . |
| + |
| + |
| = |
| ..S= o |
|.. E = o=.o |
|o.+ * B+ .. |
|.o=+.%+.o.o+ |
| .+O@oo..=+oo |
+----[SHA256]-----+
此间出现情况自行翻译就能明白。
步骤2:查看公钥保存文件
cat /c/Users/username/.ssh/id_rsa.pub
复制整串公钥。保存到GitHub的账户设置的SSH keys中。
步骤3:到GitHub上保存SSH key
登录GitHubSettingSSH and GPG keyNew SSH key添加并保存。
此时完成配置,可继续执行文章开头报错前的操作。
更多推荐
所有评论(0)