git push 报错为fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use
To push the current branch and set the remote as upstream, use)
原因
小伙伴在第一次使用git的时候,因为github中没有创建仓库或者仓库里只有一个master branch , 提交时就会显示:当前分支上面没有分支 。
解决办法
1.我们可以新建一个仓库:
代码如下:
git init
git add test00.c
git commit -m “first commit”
git remote add origin https://github.com/pony-2020/test.git
git push -u origin master
2.如果仓库已经存在
git remote add origin https://github.com/pony-2020/test.git
git push -u origin master
3.可以使用 git remote rm origin
来删除远程库