GitHub 在使用命令行 git push 时报错:The requested URL returned error: 403

使用 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

 

 

 

posted on 2013-12-10 23:00  Memory4Young  阅读(13284)  评论(2)    收藏  举报

编辑推荐:
· 编码之道,道心破碎。
· 记一次 .NET 某发证机系统 崩溃分析
· 微服务架构学习与思考:SOA架构与微服务架构对比分析
· tomcat为什么假死了
· 聊一聊 Linux 上对函数进行 hook 的两种方式
阅读排行:
· 一周 Star 破万的开源项目「GitHub 热点速览」
· 编码之道,道心破碎。
· 千万级大表,如何做性能调优?
· 不写代码,让 AI 生成手机 APP!保姆级教程
· 知名开源项目Alist被收购!惹程序员众怒,开团炮轰甲方
< 2025年6月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12

导航

统计

点击右上角即可分享
微信分享提示