How to set up a git repository with Plesk

This article will help you to set up Git repository in Plesk.

Git is a free and open source distributed version control system which is used to keep track of all the different changes made to a code base, in order to track things like who edited a certain file; what they changed: and how to get back to the original code if necessary.

What is a Repository?

A repository is a collection of files and folders associated with a project/website content, along with each file's revision history. There are two ways to create the repository and pull the files to your website.

Remote repository: The remote repository is used to publish your code to the world (or to some people) and allow them to read or write it. You can send the changes to the remote repository, and then Plesk pulls them from the remote repository and deploys them to your website.

Local repository: The local repository has exactly the same feature and functionality as the remote repository. In the local repository, you can send the changes from your local repository to Plesk, and then Plesk deploys the changes to your website

Setting up a Remote repository:


In the Remote repository, you have to add URL where your projects or website contents are stored over the internet or network and pull the files to your website. To do this, follow the below steps.

  1. Login to Plesk.

  2. Click on the websites & domains

    01-click-on-websites-and-domains



  3. Locate the domain on which you want to configure and then click on the Git option.

    02-click-on-Git-option

  4. On the Add Git Repository windows, confirm the Remote Git hosting GitHub or BitBucket option is selected. In the Remote Git repository text box, type the URL where the remote repository is hosted.

    03-add-git-repository-in-Git

  5. To select the deployment mode, click on automatically deployed, select the mode you want and then click OK.

    04-select-deploy-mode



  6. To select the deployment directory for your website, click on  /httpdocs/ select the directory which you want to use, and then click OK.  By default, httpdocs directory is used to deploy the website files.

    05-select-the-directory-for-deployment

  7. Once you select the required directory for the deployment, you have to click on the OK button.

    06-once-all-done-click-on-ok-button

  8. By clicking on the Ok button. Plesk will try to connect to the remote repository and clone it. This will take a few minutes to complete it.

    10-Creating-clone-of-remote-repository-into-local-directory

  9. Once the cloning process is completed, A new repository will be created. You can use the pull updates button to pull the changes from the remote repository and deploy them to the target directory i.e /httpdocs/.

    11-plesk-clones-remote-repository-into-local-directory



Local repository


In the local repository, you have to create a repository on your hosting space and push the files to your website. To do this, follow the below steps.

  1. Login to Plesk.

  2. Click on the websites & domains

    01-click-on-websites-and-domains

  3. Locate the domain on which you want to configure and then click on the Git option.

    02-click-on-Git-option

  4. On the Add Git Repository windows, select Local repository on your workstation. In the Git Repository in Plesk text box, type the name of the new repository.

    07-select-local-repository-on-your-workstation.png



  5. To select the deployment mode, click on automatically deployed, select the mode you want, and then click Ok.

    08-select-deploy-mode-on-local-repository.png

  6. To select the deployment directory on your site, click on  /httpdocs/, select the local directory which you want to use and then click Ok. By default, httpdocs directory is used to deploy the website files.

    09-select-directory-for-deployment-on-local-repository

  7. Once you select the required directory for the deployment, you have to click on the OK button.

    10-once-all-done-on-local-repository-click-on-ok



  8. By clicking on the Ok button. Plesk will create a repository.

    12-create-local-repository-on-your-local-system

  9. Click on the Help option to initialize the local repository.

    13-click-on-the-help-button-initialize-the-local-repository.png

  10. You will get the following windows once you click on the help button. In this windows, you will get the steps how to initiate a local repository for your website.

    14-how-to-instructions-for-test-git-for-local-repository

  11. Once you initialized the repository, you will see the commit information and the active branch. You can commit your website files from your local repository and push them to the server repository.



Was this answer helpful?

« Back

chat