Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Deploy the project to the server from GitHub     - CentOS 5.11 Open VNC access (Linux)

- Upgrading to MySQL 5.7.9 MySQL 5.6.23 (Database)

- Ubuntu 14.04 installation configuration GNOME Classic interface (Linux)

- Oracle Linux 5.5 (64bit) Install Oracle 11gR2 RAC detailed tutorial (Database)

- Linux port scanning (Linux)

- Ubuntu the ARP (arptables) (Linux)

- How to fix apt-get update can not add a new CD-ROM error (Linux)

- C ++ overloaded stream insertion operator and the stream extraction operator (Programming)

- Security experience: to see how the experts deal with DDoS attacks (Linux)

- To install Docker under CentOS7 (Linux)

- Linux server network penetration testing (Linux)

- Docker ecosystem security is gradually maturing (Server)

- Remove old kernel on Ubuntu (Linux)

- CentOS and RHEL installation under GAMIT10.6 (Linux)

- Linux environment variable configuration and save places (Linux)

- Ubuntu and derivative users to install the system launcher SimDock 1.3 (Linux)

- Detailed PHP code optimization [section] (explain reasons) (Programming)

- Java open source monitoring platform Zorka basic use (Linux)

- Python cause yum upgrade error (Linux)

- After CentOS configure SSH password Free, still prompted for a password (Linux)

  Deploy the project to the server from GitHub
  Add Date : 2018-11-21      

GitHub and it depends on the version control system Git, is definitely a very good project management and collaboration tools, whether the project is not associated with the code.

This article will discuss what options allow Git and Github better integrate into the workflow of the project which, in order to achieve a smooth automated process.

I put these options into different toolsets, these collections include automatic test run, and pull the code deployed to the server and so on.

Why do this?

With these automated processes running, you and your team can focus only associated with pure coding and code, rather than build each time have to spend a few hours to do such a thing repeated deployments.

Automation shortcomings

The main problem of automation deployment change is the change will automatically be deployed. You have to trust your team as well as they write code. That is why the automated deployment and automated testing with a typical, and the tool provided below reflects this.

More from the author's text

Blink (1), a Programmable Indicator for All Developer Needs

The Next Full Stack Language? Server-side Swift with Perfect

Of course, this also means that small problems remain the same and be a quick fix. Automation should cooperate and communicate. If pushed to the main library branch will lead to a building housing, we need to be clear, when this happens who do this thing.

An automated initial setup process may take some time. So weigh your team workflow or whether it really needs is an important thing. You spent on the testing and deployment of new build on the combined time - - if it is more than a few minutes each time, then it is worth it.

Git Hooks (hook)

Git built a framework called the expansion of the hook (http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) to automate the deployment process, and these hooks are generally specific the Git event (certain points) trigger called after our first port to handle the task. Hooks can be divided into server and client side hook hook.

server-side event is used to monitor network operation - - for example, when a repository receive push. And the client linked to the trigger because the developer performs an operation, such as committing and merging.

This is the complete list of hooks in the Git documentation (http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). I'll comment a couple in here to get you started. Hope this make you become very useful in their current project workflow manually deployed. Hooks can be run in any language project deployment, powerful and flexible.


This hook runs before all the other hook, and change before submission. It can be used to check the code for errors before submitting.

We are here to write a small JavaScript project description (of course, I deliberately left you can find a bug).

Rename hooks / pre-commit.sample   to   hooks / pre-commit, and the following test commands to such content:

#! / Bin / shjshint index.js

try to commit this change:

git commit -m "adding Javascript file"

You can see the error message:

index.js: line 5, col 25, Missing semicolon.1 error

After you add the missing semicolon resubmitted, is not being given.


When push remote Git repository is complete, the server side of the hook trigger. In this example, we launched the latest version of a simple Web site to your Web server directory is actually a (basic) deployment.

I have an existing website contains an index.html page - as well as other pages that we will use in the examples that follow. You can also create your own using a warehouse set up here.

clone warehouse, created by specifying --bear tag contains only a version control repository of information, but not our code repository:

git clone --bare https://github.com/sitepoint-editors/GitHub-Auto-Deploy.git GitHub-Auto-Deploy.git

Now we add hooks:

cd GitHub-Auto-Deploy.git / hooksvi post-receive

to add them to the file:

#! / Bin / shgit --work-tree = / var / www / html --git-dir = / var / repo / GitHub-Auto-Deploy.git checkout -f

Note: These paths are based on the following Ubuntu environment is complete, so remember to change the path to suit your path.

This command will launch a warehouse to define the current working directory, but there is no version control data.

Change the file attributes allow it to perform:

chmod + x post-receive

Tip: The location of the installation path Ubuntu related, so be sure to remember to change the path to suit your settings. This command will check the repository to define the current working directory, but there is no version control data.

Add the executable file permissions:

chmod + x post-receive

In your local side, as usual cloning this library, using the tool of your choice, and add a new remote real-time server (remember details change the server to the details of your Web servers and users):

git remote add prod ssh: //user@domain.com/var/repo/GitHub-Auto-Deploy.git

To deploy to servers of our production environment to replace the warehouse, enter the following command:

git push prod master

You can look at server ls   var / www / html   directory, you can see the index.html file is automatically copied into your web folder inside it.

If you are using your own Git repository, you can configure it to use on the same server, and automate deployment. If you are using Git on GitHub or other external services, then the hook is not yet fully automated, but it has been reduced to one step. This can be further simplified.

GitHub of post-receive hook can be used in a reync or scp option. This is another kind of choice - - especially when your application needs to build (GitHub limits the possible commands) - - the use of post-receive hook to trigger, and then use the -f option to check out from scripts and run on an application server GitHub codebase some other necessary commands. This time, automated deployment became complicated, we have to use the next set of tools to better complete.

Automatic Deployment directly from GitHub

GitHub has its own documentation to automated deployment to the integrated platform here, including some hosting providers.

To be honest, most of the documents have some errors, inaccuracies or not play a role,   in some mainstream hosting providers there, I did some search link to official documents, for a number of other providers, I recommend you use the   post-receiveor continuous integration methods:




Continuous Integration (CI) services

There are many able to see numerous changes repurchase agreements GitHub project applications, not only for you to deploy, and can perform other functions, such as running the test for you and build process.

Once you move to a new and more complex examples, we can use the CI

build process automation projects. First, draw a repository Master branch, and then trigger a bash script to run a build and deployment process as well as micro-blog updates. Or CI and web services can run on different servers on the same server, it all depends on your preference.

Let's quickly glance its most popular part of it.


You need to build your own Jenkins server, which means you can completely control over it, but it must be maintained. Fortunately, it offers multi-platform support, if you just want to try a simple case, such support also includes Docker.

Jenkins using plug-ins to achieve most of its functions, and because of its age-old, open-source nature of the wide popularity, it has a lot of plug-ins. For example, there are some   Git, GitHub   and   Twitter   of related plug-ins.

Jenkins takes a lot of configuration, and sometimes, if you want to take a combination to build your desired workflow instructions you need, you may need a lot of research.

Jenkins distributed for building and deploying - - node  

Jenkins detailed description: click here
Jenkins download address: Click here


In addition, GitHub documentation, the GitHub Travis integrated instruction outdated. Now, it is more simple: Read the documentation to find out more Travis.

Travis does not require any host server settings, so you do not need to put too much effort, you can try and keep the CI, which is a good starting point. However, extended beyond the (integrated) default integration will involve some additional configuration work. For example, microblogging requests access to the webhooks.

In repo, you'll notice Travis-- especially in their own configuration files, it has a habit of slow updates. When you do not have access to own Travis server, then the problem is difficult to solve.

Other commercial services

Continuous integration has become increasingly popular, so have a lot of new services and applications -- a lot through you may have in the creators of the tools released, and will be very harmonious integration existing tool chain and workflow among. Here are some examples:

https://buddy.works/ https://www.atlassian.com/software/bamboo/ https://www.jetbrains.com/teamcity/ https://codeship.com/ https://circleci.com/ https://saucelabs.com/ https://about.gitlab.com/gitlab-ci/ http://deploybot.com/


- Linux security configuration (Linux)
- Under Ubuntu on how to use iptables firewall (Linux)
- Java String type time compare the size (Programming)
- Observation network performance tools for Linux (Linux)
- Ubuntu Series Installation Docker (Linux)
- Volatile keyword in C language understanding (Programming)
- Linux character device - user mode and kernel mode data transfer data (Linux)
- Install Ruby on Rails in Ubuntu 15.04 in (Linux)
- Oracle 11g RAC manually playing GI PSU patch ( (Database)
- CentOS7 iptables (Linux)
- map and hash_map STL containers (Programming)
- Docker build their own private warehouses (Linux)
- Linux common network tools: Scan routing of mtr (Linux)
- Linux terminal interface font color settings (Linux)
- MySQL partition table Comments (Database)
- Linux performance monitoring (Linux)
- Archive log file size and redo log file size relationship (Database)
- How to configure AWStats in Ubuntu Server (Server)
- Compare Swift achieve rapid sorting and sorted Methods (Programming)
- Linux system security check notes on performance (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.