Automating Git with Git Configure and WebHooks

CyberPanel is introducing Git Manager in version 2.0.0 so now you can easily track files using Git which includes your website data, databases or even emails with your public or private repository at any Git supported server.

This makes it so you can directly sync your development platform to your web server.

In order to set up Git Manager, follow this tutorial: How to use Git Manager in CyberPanel

In this tutorial, we assume that you have set up Git and now you wish to automate the workflow

To automate workflow, go to “Manager Git” option in your website’s management panel

In order to configure the automation click on “Configure Git”

In the new pop-up, select how often you would like the push and pull to happen

Webhook setup

Git Manager provides you with an option to automatically pull from the repository whenever there is change.

In order to configure it, copy the Webhook URL as shown

Go to you repository page on Github or GitLab and click on Settings

Go to Webhooks from the menu

Click on “Add webhook”

On the next page enter the following

Payload URL: The link you copied from Git Configure on your own server

Application Type: application/json

Secret: Leave it empty

SSL Verification: Enable it only if you have SSL on your hostname and its properly working

Event: Just push event

Tick the box next to Active

Click the Add webhook button.

Post- Pull/Commit Command

You might want to run additional commands after the webhook is triggered and new changes are pulled, you can enter multiple commands on each line. This can be highly beneficial in order to build or optimize your application before publishing it

Congratulations, you have successfully automated git workflow