Git master branch has no upstream branch

前端 未结 10 944
北荒
北荒 2021-01-30 16:53

I\'m trying to push one of my projects to github, and I keep getting this error:

fatal: The current branch master has no upstream branch.

I\'ve

10条回答
  •  情书的邮戳
    2021-01-30 17:18

    Cool Blue's answer ALMOST worked for me.

    First I did: "git branch --set-upstream-to=origin/master master", as recommended by Cool Blue.

    But still received error message:
    "failed to push some refs to '' hint: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again."

    So I... did a "git push -f" command after the git branch, which worked finally worked for me.

    After the forced push, subsequent "git push" commands worked without issue.

提交回复
热议问题