Git push时报错:fatal: Could not read from remote repository. Please make sure you have the correct access rights

这个问题困扰了我好久,在网上试了各种方法都不管用,最后重新设置了代理才解决,现在记录一下整个流程:

  1. 先使用ssh -T git@github.om看ssh的返回信息,如果出现:You've successfully authenticated, but GitHub does not provide shell access.,则说明你的ssh连接没有问题,否则重新生成密钥,详见Github配置ssh key的步骤
  2. git config user.name以及git config user.email确认信息和github的身份信息是否匹配。
  3. 如果你clone的时候使用的是http的连接,需要更改成ssh的连接,使用git remote set-url origin abc@***.com:path/to/httpURLRepo,其中abc@***.com:path/to/httpURLRepo是你clone的库的ssh连接地址,或见:将项目原来使用Https改成SSH方式
  4. 最后,确认你的代理是否正确,cmd使用ipconfig查看本机ip,同时确认端口,使用export http_proxy=http://ip:端口设置代理。
posted @ 2024-05-26 12:18  ZCry  阅读(112)  评论(0)    收藏  举报