解决fatal:remote error:You can't push to git://github.com/username/*.git问题的办法

branch正确的情况下, 不知为什么,在push的时候总是出现:

[plain]  view plain copy
  1. fatal: remote error:  
  2. You can't push to git://github.com/user_name/user_repo.git  
  3. Use [email protected]:user_name/user_repo.git  
的提示, 解决办法:

[plain]  view plain copy
  1. $ git remote rm origin  
  2. $ git remote add origin [email protected]:user_name/user_repo.git  
  3. $ git push origin  

ok!
经过高人的点播,找到了原因:

如果在git clone的时候用的是

git://github.com:xx/xxx.git 

的形式, 那么就会出现这个问题,因为这个protocol是不支持push的

[plain]  view plain copy
  1. $git clone [email protected]:username/myNCCL.git  

就可以用git push了。



还有另外一种解决办法,直接找到.git文件(有时可能是隐藏文件)——用记事本打开config,将url内容改成如下格式即可:


猜你喜欢

转载自blog.csdn.net/qq_24135817/article/details/79830630