When pushing to github, I seem to always get a "Heads up!" message (below) that tells me that my master branch was renamed to main. But I see no main branch on the remote origin repository.
Message Example
$ git push -f
...
remote:
remote: Heads up! The branch 'master' that you pushed to was renamed to 'main'.
remote:
I've checked everything I could think of and there is no main branch on origin, there is no main branch on local. Where is that message coming from?
Here is a listing of my branches:
$ git branch --all
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Solutions Tried
I tried using git branch -u origin/master I've seen suggested elsewhere, but it did not help.
I solved it by issuing a series of commands:
First, I renamed master to random on Github, and then I ran
git branch -m random
git push origin HEAD -f # pushed changes to new branch "random"
git push origin :master # deleted master that was hanging there somehow
git commit --amend -a --no-edit # to force a commit change
git push -u origin random -f # no message!
I then reversed this process => renamed branch random to master on GitHub, and
git push origin :random
git branch -m master
git push -u origin master
git remote prune origin
git push
no more message!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With