How can I use github pages to use the main branch?

I have a static website where Jekyll is hosted on GitHub. The problem is that I don't need the main branch, since the only thing the repository contains is the website.

So I must git checkout gh-pages, then git merge master, and then do it git push origin gh-pages.

Is there an easy way when I could get rid of a branch gh-pagesand click straight out master?

+5
source share
3 answers

The problem is that I really don't need the main branch, as the only thing the repository contains is the website.

, gh-pages ?

-, . . gh-.

+14

Jekyll, ...

... , , , git push origin.

, , - git, . gh- , , refspec, , .

gh-pages: git branch -d gh-pages. gh- , master gh-. -.

0

Suppose you wanted to keep both branches (so you also have documentation).

You can simply run the script after clicking on master, which does:

git checkout gh-pages
wget https://github.com/{yourgitlogin}/{your-project}-master/archive/master.zip
git rm {your-project}-master
unzip master.zip && rm master.zip
git add -u
git add .
git commit -m "update master"
git push
git checkout master

Something like this will add your entire site as a subdirectory under the gh pages, allowing you to have both documentation and a modern example of your site in the same place and without much effort.

0
source

All Articles