How to Use Git Version Control in cPanel

Do all of your Git stuff right from within your hosting account? Yes. With cPanel you can now host a private or public repository without paying premium costs to third party Git hosting services like GitHub or BitBucket.

cPanel creation is no longer unlimited. Learn more about cPanel Pricing Changes and related FAQs.

While Git Version Control is available in all of our hosting accounts, we’d recommend a VPS or Dedicated hosting package, so you can exercise more control over individual shell user privileges. This is especially important if you plan on having other users access your Git repository.

Be very careful creating a repository in a directory that already contains files. If, for some reason, you delete the repository from cPanel, the whole directory will be erased!

How to Create a Git Repository with cPanel

In this first part we’re creating a new repository. Later, we’ll show you how you can “clone” an existing repository instead.

If you’re creating a repository for the first time, you’ll be prompted to fill in the necessary fields right away. Otherwise, you’ll just need to click the blue Create button. These steps are detailed below:

  1. Log into cPanel
  2. Select Git Version Control under Files
  3. Click Create (if you haven’t created any repositories yet, you’ll be skipped ahead to the next step automatically)
  4. Toggle off the Clone a Repository button
  5. Fill in the file path to the new repository
  6. Provide a name for the repository as it will appear in your cPanel interface
  7. Click Create at the bottom

Now, cPanel will create the repository and provide you with some helpful Git commands you can run in a shell session in order to use this repository.

How to “Clone” a Git Repository in cPanel

Instead of creating your own Git repository, you can “clone” a repository that already exists out on the Web: for example, from the popular Git hosting site GitHub.

  1. Log into cPanel
  2. Select Git Version Control under Files
  3. Copy the clone URL into the Clone URL
  4. Fill in a file path for the repository (remember the cloned repository provides its own directory)
  5. Fill in a name for the repository as it will appear in your cPanel interface
  6. Click Create

Now you have successfully cloned a repository into your hosting account. This is a great way of cloning in a homepage you may have under version control at a different location or just a repository of various scripts or assets you may need for a project.

Why Create a Git Repository in cPanel

It’s true that you can launch your own repository wherever you have Git installed. However, cPanel makes the process much easier by creating the repository and the necessary executable files to save and launch your project right away.

But, if you want to do it the long way, you can follow our article on using Git to publish files.

Manage Projects With Ease

We’ve gone into some depth explaining how Git works in our Git tutorial series. But if you want a closer look to see how Git can work for you, you can now easily set up a Git repository with any of our cPanel hosting accounts.

Helpful Commands Delivered

cPanel gives you the essential commands you’ll need to get started the instant you’ve created your repository.

Let us Know What You Think

Have you been using Git for a long time, or you just getting started?

If you need any further resources about Git, be sure to check these out:

We’re excited that our hosting customers can now easily set up and use Git repositories from within cPanel. If you have troubles along the way, be sure to leave a comment and let us know.

Thoughts on “How to Use Git Version Control in cPanel

    • Hello James,

      Thank you for your question. Unfortunately, it appears that the cPanel Git Version control utility cannot be used to create a bare repo. However, you should be able to create a bare repo elsewhere and clone it using the utility.

      I do hope this helps,

      Best Regards,
      Alyssa K

    • Cloning a private git repository cannot be done with the standard “git://” nomenclature. You will need to use “git@”. I found the information for this answer here.

      “Private clone URLs take the form git@github.com:username/repo.git – perhaps you needed to use git@ rather than git://?

      git:// URLs are read only, and it looks like private repos do not allow this form of access.”

Leave a Reply to InMotionFan Cancel reply