Welcome to my website, have a nice day!
Dream it, Do it, Make it!

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
赞(0)
未经允许禁止转载:Ddmit » git push提示错误:fatal: remote error

评论 抢沙发

登录

找回密码

注册