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

- 日理万妓 2022-02-15 03:15 281阅读 0赞

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

  1. MBP:baiyunshen_rn lianyu02$ git pull
  2. git@gitlab.intebox.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
  3. fatal: Could not read from remote repository.
  4. Please make sure you have the correct access rights
  5. and the repository exists.

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

  1. ssh-keygen -t rsa -C "fangcaiwen",//fangcaiwen是你git操作的账号。
  2. Generating public/private rsa key pair.
  3. Enter file in which to save the key (/Users/lianyu02/.ssh/id_rsa): //回车
  4. Enter passphrase (empty for no passphrase): //回车
  5. Enter same passphrase again: //回车
  6. Your identification has been saved in /Users/lianyu02/.ssh/id_rsa.
  7. Your public key has been saved in /Users/lianyu02/.ssh/id_rsa.pub.
  8. The key fingerprint is:
  9. SHA256:oXm37ngA1/jn+dHYsSTrePXNvT9hHEqdjl1ktdW8Z2w fangcaiwen
  10. The key's randomart image is:
  11. +---[RSA 2048]----+
  12. | .=|
  13. | B|
  14. | .o .=o|
  15. | .oo.. . =E|
  16. | ooS.. ..*=+|
  17. | ......o+@o|
  18. | ..o o=oB|
  19. | o. =. o=|
  20. | .oo..o..=|
  21. +----[SHA256]-----+

然后再执行,

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

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

![Image 1][]

按箭头所示.jpg

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

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

[Image 1]:

发表评论

表情:
评论列表 (有 0 条评论,281人围观)

还没有评论,来说两句吧...

相关阅读