How do I use Git version control in My20i?

Richard Chambers
Published: 30 August 2022
Share:

My20i includes a graphical user interface to manage Git™ version control.

You can clone, manage and deploy Git repositories directly. You're able to manage multiple repositories in one package, allowing you to keep track of version changes and deploy your sites as and when you’d like - at the click of a button.

To access this tool:

  • Log into My20i and head to your Manage Hosting area.
  • Select Options > Manage on the hosting package you’d wish to edit.
  • Under the Web Files area you should see the option for GitTM Version Control – select this option.

Git Version Control in My20i

  • You’ll be prompted for a name and email – set these to be the name and email you’d like to show when deploying using Git, and select Enable.

Enter name and email to identify yourself in Git

You'll then see your current repository list, and see options to set up your first repository.

A list of Git repos and the options to create new ones

Cloning a Git repository

Cloning a repository via the tool requires you to first create a remote repository using GitHub, following the steps highlighted in their documentation.

Once done, head to the repository and copy the URL by selecting Code, then copying the URL provided without the SSH protocol included.

Clone a repository in My20i`s Git GUI

Once you have the URL above, paste it into the Clone URL area, then set the file path of where you want your repository to set up. Lastly, set up a Repository Name - this is purely a display name for the UI itself.

Then, hit Create. Once done, your repo should show in the list like this:

A newly-created Git repository in the list in My20i

You can then use the three dots to manage the repository, check the history, go to the files directly via File Manager, copy the URL or remove the repository from the list.

A menu of Git actions in My20i

Managing a repository

Managing a repository allows you to check and update information about the repo itself. You can do so via the Basic Information tab:

Check and update information about a Git repository in the My20i menu

You can also pull or deploy changes to the repo using the Pull or Deploy tab. Select Deploy HEAD Commit to deploy the changes you've made to your repository directly.

Pull, deploy or commit a repo in My20i

You can use the History tab to see what changes have been deployed in the history of the Git setup.

Creating a local repository

If you don't want to deploy to a remote repository, and instead simply use a local one in your package’s file space, you can set this up via the UI too. To do so, select Create New Repository and then hit the Local Repository tab.

Creating a local Git repository in My20i

You can then fill out the fields to choose the folder you'd like the repository to be in, the name, as well as selecting the Deployment Type and Deployment Branch.

The type defines whether or not you want automatically to deploy changes, or if you want to only deploy your changes when manually selecting the Deploy button.

The branch is what Git branch you want to deploy these changes to. You can have multiple branches of development to work from if you want to make tweaks to the code without affecting your repository's main codebase.

Git branches

More information on branches is available here: Using Git Branches.