Search code examples
githubgithub-pages

How can I only have a gh-pages branch?


I'm doing some basic demos with javascript pages - using github not only as source control but also as a hosting provider.

I'd like to work only on the gh-pages branch, or have it automatically reflect my changes on master, whatever is easier and cleaner.

I tried to delete the master branch but it won't let me:

$ git push origin --delete master
remote: error: refusing to delete the current branch: refs/heads/master
To [email protected]:opensas/geo-demo.git
! [remote rejected] master (deletion of the current branch prohibited)

I just want to have a single branch (master or gh-pages) and whatever I commit and push to it to appear in the github pages.

What is the best way to accomplish this?


Solution

  • If you want to remove master from GitHub you have to go to GitHub and set gh-pages as your default branch. Only then can you delete master.