How to publish Drupal Pages in GitHub

20/07/2016

There are a lot of sites where to publish web applications. One of the simplest is with Github:  Github pages. We can create it through the interface github but it is faster (and cool) using git command.

There are two alternatives with this tool:

- Through a special repository where the content will be save. In this case, all files should be in master branch. The URL will be user.github.io

- Pages associated with a repository of Github. Files will be in a new branch:  gh-pages. the URL will consist user.github.io/project

Now, we are going to explain the second case:

First, we create a new branch called gh/pages. Github will automatically publish it.

git checkout -b gh-pages

git push -u origin gh-pages

We can access the web site with the URL user.github.io/project/index.html

If we usually develop from master and we want to  update the changes in the web create in Github with gh-pages, we only  should use this commands

Update:

git push origin master

Changing the branch:

git checkout gh-pages

Mixing the changes:

git merge master

Upload the changes:

git push origin gh-pages


Github is a powerful tool  to work and to developers projects, As we have seen in this post, it is very simple and useful to publish a web site and  keeping an updated it.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.