欢迎光临
一个废柴的博客

git push提示错误:fatal: remote error

在使用git push命令将改动的文件提交到远程仓库时,git bash提示错误:

fatal: remote error: You can’t push to git://github.com/user/repo.git   Use  https://github.com/user/repo.git,

下面是出现这一错误的原因分析:

1.首先我从远程仓库clone到本地时使用的命令是:git clone git://github.com/user/repo.git;

2.提交改动时报错:fatal: remote error: You can’t push to git://github.com/user/repo.git Use https://github.com/user/repo.git

之所以出现这样的情况原因是:

git clone git://github.com/user/repo.git这样的url请求是只读的,像[email protected]:user/repo.git 以及 HTTPS URL比如: https://github.com/user/repo.git才是可写的,具体描述见官网:https://help.github.com/articles/pushing-to-a-remote/#what-can-i-push-to;

所以解决办法如下:

git remote rm origin
git remote add origin [email protected]:user/repo.git
git push origin master

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址