1

Just created a new github account, and noticed that i am unable to delete the main branch using this command:

git push origin :main

This returns the error:

 ! [remote rejected] main (refusing to delete the current branch: refs/heads/main)
 error: failed to push some refs to 'github.com:accountname/reponame.git'

Any idea why i cant delete this branch? It hints at not being able to delete the "current" branch, but i am on another branch ..

Davy
  • 6,295
  • 5
  • 27
  • 38
  • 1
    `main` is likely the "default" branch and your repo must have a default branch. See here: https://stackoverflow.com/a/12208843/6889416 What is it bigger picture task that you are trying to do? Rename the default branch? Switch to another default branch? – TheIceBear Jun 07 '22 at 17:48
  • Yes, i want to use master as default branch. Thanx for the link, that was what i was looking for ;) – Davy Jun 07 '22 at 18:05
  • Since you are using GitHub I recommend doing it on github.com. https://github.com///settings/branches. GitHub has support so old links redirect that I am not sure applies if you do this manually. – TheIceBear Jun 07 '22 at 18:10

0 Answers0