Rather than a version control tool, Git is also popular for relatively simple deployment automation. And in this section, we'll get our hands on and configure automated deployment based on Git.
The idea of passive deployment is simple: when a client pushes commits to the bare repository on the server, a post-receive
hook of Git will be triggered. And thus we can add scripts checking out changes and start deployment.
The elements involved in the Git deployment solution on both the client and server sides includes:
To make this mechanism work, we need to perform the following steps:
Create a bare repository on the server with the following command:
$ mkdir deployment.git $ cd deployment.git $ git init --bare