解决fatal:You can‘t push to git://github.com/username/*.git

在本地git仓库写完代码后,利用 git push 命令提交到远程仓库时,总是出现如下报错:

不能将代码上传到远程仓库

解决办法:

git remote rm origin
git remote add origin [email protected]:username/*.git
git push origin

如果是在git clone 时用的是

git clone git://github.com/username/*.git

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

应使用如下命令,才可以使用 git push 

git clone [email protected]:username/*.git

另有一种解决方法:

直接找到 .git 文件夹(改文件夹为隐藏文件夹)中的 config 文件,将 url 内容改成如下格式

猜你喜欢

转载自blog.csdn.net/qq_34935373/article/details/118102927