Git使用中报错fatal: The current branch master has no upstream branch
首先第一步按照git官方提供的解决方案。
git push --set-upstream origin master
如果这一步没有解决问题,还出现了
git 报错 :Updates were rejected because the tip of your current branch is behind 解决方法
报错原因:因为远程仓库有的文件,本地没有。因此报错
第一种解决办法:删除远程git仓库的文件,再进行推
第二种强制推送并且覆盖远程git仓库:git push -f origin master
注意:千万不要用:git pull --rebase origin master这个命令,这个命令,拉远程git仓库文件,并且覆盖本地文件。因此就会把我们本地还没有上传git的文件给覆盖掉,我们本地写的东西就没了