Delete master error (GIT push origin: Master)

Source: Internet
Author: User


All good so far. We next want to delete the branch on GitHub. However, if we do this the naive way:

git push origin :master

We just get an error like this:

remote: error: refusing to delete the current branch: refs/heads/masterTo [email protected]:matthew-brett/datarray.git! [remote rejected] master (deletion of the current branch prohibited)error: failed to push some refs to ‘[email protected]:matthew-brett/datarray.git‘

That is because GitHub is looking atMasterBranch to provide the Web content when you browse that repository. So we first have to make GitHub look at ourPlaceholderBranch instead, then deleteMaster.

First push upPlaceholderBranch:

git checkout placeholder # if not on placeholder alreadygit push origin placeholder

Then setPlaceholderTo be the GitHub default branch. Go to the main GitHub page for your forked repository, and click on the "admin" button.

There's a "Default branch" dropdown list near the top of the screen. From there, selectPlaceholder. On the interface I'm looking at, a green tick appears above the dropdown list. Now you can do (from the command line ):

git push origin :master

And-no master branch...

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.