Git 提交远程仓库错误

1、

$ git push origin 远程分支名 
error: src refspec branch_name does not match any.
error: failed to push some refs to 'XXX.git'

网上找了大都是本地版本库为空, 空目录是不能提交之类的,但是我明明先add再commit最后push的...不久前也才成功提交,真是纠结,最后找到了另一种提交形式

$ git push origin HEAD:远程分支名

还真的成功了,但是$ git push origin 远程分支名  还是不行,看样子在找到解决方法前还是将就着点吧 = =!如果有朋友知道的话还望指教下O(∩_∩)O哈!


2、

fatal: could not read Username for 'https://github.com': No such file or directory
解决方法先删除本地的 remote 重新添加解决...之前的是直接clone下来的 https://github.com/ username/项目名称.git

git remote rm origin
git remote add origin '[email protected]:username/项目名称.git'


你可能感兴趣的:(Git)