Git操作中HTTP错误

如果你在使用 HTTP 协议进行 Git 操作的时候出现错误提示:


401 错误:

$ git push origin master
error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

Everything up-to-date


403 错误:

$ git push origin master
error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date
上面2个错误有以下几个可能导致的:

Git 版本过低。GitCafe 推荐使用的 Git 版本是 >= 1.7,请参考这里获取最新版本。

$ git --version git version 1.8.2.1
远程仓库路径设置错误。注意,GitCafe 对于路径的识别是大小写敏感的。

查看已有的远程仓库:

$ git remote -v
origin https://gitcafe.com/GitCafe/help.git (fetch)
origin https://gitcafe.com/GitCafe/help.git (push)
设置新的远程仓库路径:

$ git remote set-url origin https://gitcafe.com/GitCafe/Help.git
查看新的远程仓库路径:

$ git remote -v
origin https://gitcafe.com/GitCafe/Help.git (fetch)
origin https://gitcafe.com/GitCafe/Help.git (push)
对该仓库没有访问权限。检查你是否对目标仓库有相应的读写权限。

输入了错误的用户名和密码。检查你是否使用了对该仓库有写权限的正确的账户名称和密码,检查是否对所有你名下的仓库均不能访问。


411 错误:

error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly
这个错误是因为是由于上传的包过大 HTTP 的头出错导致的。

解决方法:

需要设置http.postBuffer,设置为50MB就可以了

git config http.postBuffer 524288000
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值