在git push提示Please make sure you have the correct access rights and the repository exists.

在服务器上sudo git pull 的时候,报错 Please make sure you have the correct access rights and the repository exists.

解决步骤:
在gitbash中

  1. 输入 ssh-keygen -t rsa -C “bneglect” //bneglect是你git操作的账号
    会显示 Generating public/private rsa key pair.
  2. Enter file in which to save the key (/home/liangwu/.ssh/id_rsa): //什么都不用输入,直接回车
    Enter passphrase (empty for no passphrase): //什么都不用输入,直接回车
    Enter same passphrase again: //什么都不用输入,直接回车
    显示 Your identification has been saved in /home/liangwu/.ssh/id_rsa.
    Your public key has been saved in /home/liangwu/.ssh/id_rsa.pub.
    The key fingerprint is:

SHA256:RbwKQOd9htV5zh9Qdl/EaWZQWqa5SJHeKgFk7nGHv0E bneglect
The key’s randomart image is:
±–[RSA 2048]----+
| … oo .oo.o+O=|
| .ooo +o.+.O==|
| …o+o=E.B= .|
| o o=*…+. |
| oS…+… …|
| … .o .|
| … |
| |
| |
±—[SHA256]-----+
在指定路径下生成了两个文件id_rsa.pub and id_rsa
我们需要把id_rsa.pub中的内容粘贴到服务器ssl证书管理处;
github参考输入公钥的位置如下图在这里插入图片描述

  1. 然后进入code.aliyun.com/profile目录下(或者找到设置->ssh公钥->增加ssh秘钥)
  2. (服务器上)密钥对所在目录 /home/bneglect/.ssh/

上面的方法没解决在看下面的
5. 如果修改了密钥对, 还是不好使,那么可以修改origin 地址, git remote -v 查看一下, 如果是ssh地址, 那么就登录github或者code阿里云复制https地址,
通过命令 git remote set-url origin https://code.aliyun.com/a/b.git 修改, 重新Git pull 试试
(举个栗子: 将url = git@github.com:manishnakar/polymer-demo.git ; 改成url = https://github.com/manishnakar/polymer-demo.git 即可)
6.猜测可能因为 (可能是因为git新账号的原因)(或者说可能是code阿里云上新成员)
7.需要重新选择下git上的ssh地址 因为默认配置的https地址


8.使用 cat .git/config 查看本地设置的仓库URL地址和github使用的链接地址是否一致.
ssh -T git@github.com检查公钥是否有问题

本文转载自https://www.cnblogs.com/bneglect/p/11253298.html
为查看方便略作补充。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值