git问题:Please make sure you have the correct access rights and the repository exists.

当遇到如标题所示问题,打开终端

MBP:baiyunshen_rn lianyu02$ git pull
git@gitlab.intebox.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

遇到这种问题怎么处理?很简单
如下:

ssh-keygen -t rsa -C "fangcaiwen",//fangcaiwen是你git操作的账号。
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/lianyu02/.ssh/id_rsa): //回车
Enter passphrase (empty for no passphrase): //回车
Enter same passphrase again: //回车
Your identification has been saved in /Users/lianyu02/.ssh/id_rsa.
Your public key has been saved in /Users/lianyu02/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:oXm37ngA1/jn+dHYsSTrePXNvT9hHEqdjl1ktdW8Z2w fangcaiwen
The key's randomart image is:
+---[RSA 2048]----+
|               .=|
|                B|
|        .o    .=o|
|      .oo..  . =E|
|      ooS.. ..*=+|
|       ......o+@o|
|         ..o o=oB|
|         o. =. o=|
|        .oo..o..=|
+----[SHA256]-----+


然后再执行,

 cat /Users/lianyu02/.ssh/id_rsa.pub    //这个路劲在你上面不断回车里可以找到
结果是:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9+KpKzJKJjFkFABmSAPX74Rjn5qh3jQfbhbXppvIOTMU2fd/ribLQ+mP5Dj89IRAKGyQ/+vwyq0O6Y1e92Rst+Uyd9dgxk+CqK+fAsaHoVF9yCyJBA5eY6IiX5Vh5sbWHKsMfJUNt2rp9MjXrMJjkrxjCaa74iXeUvE9eN3ZRbxyehLP+EOv2nakxyvdao3moiWVHpJb1HdIoJQg9AGz5XqE6BLxegrpte0KJ+knnZtY1FE2Q7WvC/9pu9/IA7JWC8M85CcldR/iwRSDKn9bJesWIi0Og9tRAkRvSEQlr4lSL7fvlPDAV19tIRZ2itpD7uUESjFld05u0MMZjsMN7 fangcaiwen

如果你是gitlab出现这个问题,(github也一样)找到设置,点击SSH keys
如图所示:

 

按箭头所示.jpg

 

按图中箭头处粘贴上面的结果,点击增加Add key,然后回终端git pull,完美解决问题




链接:https://www.jianshu.com/p/c3089a7a7012
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值