Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 781
opensas Avatar asked Jul 01 '13 01:07

opensas


People also ask

How do I branch GH-pages?

app, change directory back to the parent folder, setup a "gh-pages" subfolder for your "gh-pages" branch and change directory into it. Clone your "grandmaster" repository into the "gh-pages" folder (this will clone in the "master" branch), checkout the "gh-pages" branch, list the files (should have "index. html" and ".

Do you need a GH-pages branch?

You no longer have to use gh-pages . @DanDascalescu It's not true. You can only use the master branch, or the master branch's docs folder, or gh-pages.

How do I switch to GH-pages?

Go to your GitHub repository, click on the settings tab, and scroll down to the GitHub Pages section. The branch should be configured to gh-pages and the folder set to / (root) as illustrated below. Note the URL for the website, you will use it later in the guide.


1 Answers

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.

like image 115
Ian Stapleton Cordasco Avatar answered Oct 09 '22 15:10

Ian Stapleton Cordasco