Git is a version control system, which can be used to track changes to any file, but it is generally used to develop software. It is designed to coordinate work between programmers, but it also can be used in order to track changes to any set of files.
If you want to deploy a git repository, you can simply do so through your Hostinger hosting menu. This is an advanced feature Hosting → Advanced → GIT:
In our case, it is a private repo, which means that to deploy we must first create an SSH key and then add it to your GitHub/BitBucket or any other service to deploy private repositories.
- Login to https://github.com/ (or) bitbucket
- Choose the appropriate repo and go to settings, then select the section for deployment keys
- Add your new deploy key and a little description + title
Then you should see the following information and the date when this key was last used:
4. Now go to your Hostinger account to make your first deployment
5. In the Create a New Repository field, you can set up your deployment settings:
- Make sure you select the correct Repository Address and Branch, or the deployment will fail
- Leave the Install Path empty, and your website will be deployed to your account's root folder (/public_html)
6. For private repositories: git@github.com:WordPress/WordPress.git as follow:
7. Install path directory must not contain any files or folders, otherwise, the deployment will fail
Once you add a New Repository to the account, you will be presented with four buttons:
8. Press the deploy button and it will launch it right away as expected
9. The deployment status can be tracked through “View latest build output” if you want to see some details about your latest build and what happened
10. You can use the Webhook URL for automatic deployment to merge a selected Git branch. The Webhook URL will be given to you once you press the Auto Deploy button.
Webhooks allow you to build or configure integrations that subscribe to certain events on GitHub. When one of these events is triggered, the script starts. Webhooks can be used to update an external issue tracker, update a backup mirror, or even deploy to your production server.
If you're looking for how to improve development's workflow using Local WP and Git for Wordpress, this post will be helpful. Happy blogging!