当前位置:   article > 正文

git push 报错为fatal: The current branch master has no upstream branch. To push the current branch and_the current branch main has no upstream branch. to

the current branch main has no upstream branch. to push the current branch a

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
来删除远程库

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/煮酒与君饮/article/detail/891428
推荐阅读
相关标签
  

闽ICP备14008679号