使用 git 的命令行向 GitHub 提交的时候,报错:

[Young@localhost OtherLang]$ git push origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/YoungZHU/OtherLang.git/info/refs

fatal: HTTP request failed

 

【解决办法】

1)在该资源库(Repository)的目录下,运行

cd .git
# 执行后,可以用 ls 命令查看一下,会有一个 config 文件

2)修改 config 文件

  找到 [remote "origin"] 节点下的 url 项,

  由原来的

url = https://github.com/YoungZHU/OtherLang.git

 

  改成

url = ssh://git@github.com/YoungZHU/OtherLang.git

 

注意将 用户名(YoungZHU)资源库名(OtherLang)换成自己对应的

 

OK ,再提交试试

git push origin master

 

 

 

相关文章:

  • 2022-12-23
  • 2021-11-09
  • 2021-12-09
  • 2021-12-26
  • 2021-07-11
  • 2022-12-23
  • 2021-08-04
  • 2022-01-17
猜你喜欢
  • 2021-12-14
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2022-03-10
相关资源
相似解决方案