How to publish Drupal Pages in GitHub
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
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.