{"id":49469,"date":"2018-06-13T13:00:00","date_gmt":"2018-06-13T18:00:00","guid":{"rendered":"https:\/\/blog.cpanel.com\/?p=49469"},"modified":"2018-06-13T13:00:00","modified_gmt":"2018-06-13T18:00:00","slug":"git-version-control-series-setting-up-git","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/products\/git-version-control-series-setting-up-git\/","title":{"rendered":"Git Version Control Series: Setting Up Git"},"content":{"rendered":"

This is the fourth in a series of blog posts around Git and a new feature in version 72,\u00a0Git Version Control<\/a>.\u00a0 See the full list of entries in this series at the end of this post!\u00a0 <\/em><\/p>\n


\n

If you follow our\u00a0feature request site<\/a>, you already know about our upcoming feature, Git™ Version Control. We’re designing it to make hosting repositories as easy for developers as a “Hello World!” script.<\/p>\n

Git’s extremely useful when you configure it to transfer content between a local and remote repository. When you set this up, changes on your local branch automatically push to your cPanel-hosted repository.\u00a0Of course, before you can use our feature for this, you will need to set everything up.<\/p>\n

Creating repositories<\/h2>\n

Before you can do anything in Git, you need repositories! You’ll need one on your local computer and one hosted on your cPanel account.<\/p>\n

To create one on your cPanel account:<\/span><\/p>\n

    \n
  1. Log in and navigate to the Git Version Control interface.\u00a0<\/span><\/li>\n
  2. Click Create, enter a repository name and path\u00a0<\/span><\/li>\n
  3. Click the toggle to create a new repository (rather than cloning one.)
    \n
    \"Git<\/a>
    \n<\/span><\/li>\n
  4. Now, you want to clone that repository to your local computer. (You could<\/span><\/em> create a new repository with the ‘git init’ command and then hook everything up to use your cPanel-hosted repository as the remote but trust us \u2014 this is easier.)<\/span><\/li>\n
  5. Go back to the list of repositories, find your new repository, click the expand button, and then copy the clone URL to your clipboard.<\/li>\n
  6. , Run the ‘git clone’ command. (You can find that command and a few others on the success page when you first create a repository.)<\/li>\n<\/ol>\n

    \"Projects\/my-repo<\/a><\/p>\n

    Setting up your workflow<\/h2>\n

    To ensure that you don’t accidentally transfer changes, create and check out a separate branch. Here, we’re calling that branch ‘release’.<\/p>\n

    \"Projects\/my-repo<\/a><\/p>\n

    \"I<\/a><\/p>\n

    Then, push the branch to the cPanel-hosted repository.<\/p>\n

    \"Projects\/my-repo<\/a><\/p>\n

    Congratulations! The branch on your local computer is connected to the branch on your cPanel account. Git now assumes that you want changes on the local branch pushed to your cPanel-hosted repository. You’re not quite finished yet, though.<\/p>\n