GIT with cPanel

Check out we want to use GIT Repos in the cPanel environment

Featured image for GIT with cPanel

Setup

You'll want to do this step when first setting up an environment or if you come accross an environment that doesn't have a repo setup yet.

If in an existing environment, you'll want to make sure the EE is saving Templates as Files. If not, do the following:

  • Create a Backup of the database as doing this wrong can delete all of your templates!
  • In Addons, uninstall Template Sync if it's installed
  • In Settings -> Content & Design -> Template Settings, turn on Save Templates as Files
  • Make sure the files exist as well as the Templates in Template manager

Now, to create the Repo:

  • In cPanel, open 'Git Version Control'
  • Click Create
    • Turn off 'Clone a Repository'
    • Repository Path: 'public_html'
    • Repository Name: Enter the name of the site or company
    • Click 'Create'
  • A .git folder will be created in the 'public_html' folder, you can now manage it

Next we need to use cPanel's Terminal feature to enter commands. In order to use terminal, SSH access may have to be enabled.

IMPORTANT: Terminal is only to be used for navigating directories and managing Git repos

cd public_html
git config --global user.email "support@omahamediagroup.com"
git config --global user.name "OMG Support"
git add --all
git commit -m "Initial commit"

When and How to Use

When

  • You'll want to commit at least occasionally throughout development on a site/project, but really as often as you like
  • Any time you make a change or a fix on an existing project
    • If a repo doesn't exist on an existing project, refer to the Setup section

How

Go into Terminal:

cd public_html
git add --all
git commit -m "Detailed commit message"

Commit Message Guidelines

  • Start with Capital, no period at the end
  • Proper capitalization, punctuation throughout (Ex: ‘XML’ should be capitalized)
  • Message should answer 'What was changed?', possibly 'Why?', not 'How?'
  • Write the Message as if you were finishing this sentence: “In this commit, I…”

Learn More cPanel Git Version Control Documentation|https://documentation.cpanel.net/display/72Docs/Git+Version+Control|Basic Git Commands|https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html