This is the sixth and final blog post in a series around Git and a new feature in version 72, Git Version Control.  See the full list of entries in this series at the end of this post! This post talks about something that we’re adding in Version 74, which we expect will be entering EDGE sometime during the first week of July, and will be headed to CURRENT sometime in July! 


If you have been following along on the feature request site, you already know about our new feature, Git Version Control. We’re designing it to make hosting repositories as easy for developers as a “Hello World!” script — and, in cPanel & WHM Version 74, we’re adding deployment to the mix, too!

This feature will let you create and manage repositories and view change history in a friendly interface. A lot of Git’s functionality requires command line knowledge, but don’t worry! It’s easy to learn. Here’s the rundown on what you can expect from our new deployment functionality.

Automatic and Manual Deployment

cPanel’s Git Version Control feature (cPanel >> Home >> Files >> Git Version Control) automatically adds a post-receive hook to all cPanel-managed repositories.

  • When you push changes directly to a cPanel-managed repository that includes a .cpanel.yml file, the hook deploys those changes automatically.
  • For more information, read Git’s githooks documentation.

Automatic or “push” deployment of a website.

With automatic or push deployment, a single git push command sends changes from your local computer to your cPanel-managed repository. The system then automatically runs the commands in your .cpanel.yml file to send changes from the cPanel-managed repository to a production directory. (For example, to the directory that contains your website’s public files.)

Manual or “pull” deployment of a website with a remote repository.

With manual or pull deployment, the git push command sends changes from your local computer to a remote repository. When you click Update from Remote in the Manage section of the Git Version Control interface (cPanel >> Home >> Files >> Git Version Control), the system retrieves changes from the remote repository and applies them to the cPanel-managed repository. When you click Deploy HEAD Commit, the system runs the commands in your .cpanel.yml file to send changes from the cPanel-managed repository to a production directory. (For example, to the directory that contains your website’s public files.) For a valid .cpanel.yml file, check our documentation site: Guide to Git: How to set up deployment

Prerequisites

Before deployment, repositories must meet the following requirements:

  • A valid checked-in .cpanel.yml file in the top-level directory.
  • One or more local or remote branches.
  • One or more local commits.
  • clean working tree.

If a repository does not meet these requirements, the system will not display deployment information and will disable deployment functionality.

Awesome, right?

If you already use Git, we hope that this feature will knock your socks off! If you don’t, we’re hoping we can help you start!


A note from benny:

Ready to give it a shot? The Git Version Control feature is already available to any server on the RELEASE tier. You can join us in our slack or discord channels, post your questions on the cPanel forums or subreddit, or come visit Houston, Texas for the 2018 cPanel Conference, October 1st – 3rd. Need to catch up on the previous posts about Git Version control? Here they are!

  1. What is Git? 
  2. Introducing the Git Version Control interface
  3. Introducing Gitweb
  4. Setting Up Git
  5. Git Problems and How to Fix Them
  6. Git Version Control: Soon with Automatic Deployment!