1.failed to push some refs to git

将代码从本地push到远程仓库时出错

git报错汇总_版本库


网上查找资料发现出现错误的主要原因是github中的README.md文件不在本地代码目录中。要么添加文件,要么使用以下命令

git pull --rebase origin master
// pull=fetch+merge

2.fatal: Updating an unborn branch with changes added to the index.

执行下面的代码

git pull --rebase origin master

由于项目只提交到版本库没有提交分支,所以报错,因此需要

git commit -m ""

然后再执行

git push -u origin master

3.error: src refspec master does not match any

目录中没有文件,空目录是不能提交上去,因此需要添加文件

参考链接
​​1.​​2.
3.
​4.​