Support guide

Deploying with Git in Plesk

Pull from remote Git hosting or push directly from your computer, then publish a tested branch without uploading files one by one.

Choose how Plesk receives your code

Plesk supports two Git workflows. Both deploy a selected branch to your website, but the route your commits take is different.

Remote Git hostingPush to GitHub, GitLab or Bitbucket. Plesk then pulls from that service and deploys the files.
Local repository on your workstationPush directly from your computer to a Git repository created inside Plesk, without another hosting service.
What “local repository” means in Plesk

Your working repository remains on your computer. Plesk creates a receiving repository on the server, and you add its URL as a Git remote before pushing to it.

Before you start

Repository accessFor remote hosting, have the HTTPS or SSH clone URL ready. For a direct push, Plesk will provide the repository URL.
Production branchDecide which tested branch Plesk should deploy, usually main or master.
Current backupBack up the live website and database before the first deployment or a major change.
Keep secrets out of Git

Do not commit passwords, API keys or production configuration. Keep environment-specific files on the server and exclude them from the repository.

Option 1: connect remote Git hosting

  1. 1
    Open Git for the domain

    Sign in to Plesk, open Websites & Domains, select the website and choose Git.

  2. 2
    Add the repository

    Select Add Repository, then choose Remote Git hosting.

  3. 3
    Enter the clone URL

    Paste the remote repository’s HTTPS or SSH URL. For a private repository, use its authentication method; with SSH, add the public key generated by Plesk to the repository provider as a deploy key.

  4. 4
    Choose the target and deployment mode

    Confirm the live directory, normally /httpdocs, and select Manual deployment for the first release.

  5. 5
    Clone the repository

    Select OK. Plesk will connect to the remote service and create its server-side clone.

Option 2: push directly from a local repository

  1. 1
    Create the Plesk repository

    Open Websites & Domains > Git, select Add Repository, then choose Local repository on your workstation.

  2. 2
    Name it and choose the target

    Enter a repository name, confirm the live directory—normally /httpdocs—and select Manual deployment for the first release.

  3. 3
    Copy the Plesk repository URL

    Select OK, then copy the SSH or HTTPS repository URL displayed by Plesk. Use the commands under Plesk’s Help link if they differ from the examples below.

  4. 4
    Prepare the local repository

    In a terminal, open your website folder. If it is not already a Git repository, initialise it and create the first commit.

cd /path/to/your/website
git init
git add .
git commit -m "Initial website"

Skip git init and the initial commit if the project is already tracked by Git. Add the Plesk repository as a second remote named plesk, then push the production branch:

git remote add plesk <repository-url-from-Plesk>
git push -u plesk main
Authentication and branch names

An HTTPS repository may ask for the subscription’s FTP username and password. SSH requires SSH access for the subscription. Replace main with master or another production branch when required.

Can’t see Git?

The Plesk Git extension and Git management permission must be available for the subscription. Contact Horizon Hosting support if the Git option is missing.

Complete the first deployment

  1. 1
    Check the branch and path

    Use Change branch and path to select the branch you pushed and confirm the correct document root.

  2. 2
    Get the expected commit into Plesk

    For remote Git hosting, select Pull Updates. For a direct local-repository workflow, the push has already sent the commit to Plesk.

  3. 3
    Deploy the files

    Confirm that Plesk shows the expected commit, then select Deploy from Repository.

  4. 4
    Test the live website

    Open important pages, submit any critical forms and check the Plesk log if the site reports an error.

Deploy later updates

Commit tested changes from your computer before sending them to either deployment route.

git status
git add <changed-files>
git commit -m "Describe the update"
Using remote Git hostingRun git push origin main. In Plesk, select Pull Updates, review the commit and select Deploy from Repository.
Using the Plesk repositoryRun git push plesk main. The commit is already in Plesk, so review it and select Deploy from Repository; do not use Pull Updates.
Avoid editing deployed files directly

A later deployment can replace changes made in Plesk File Manager. Make lasting changes in the repository, commit them and deploy again.

Optional: deploy automatically after a push

Once the manual workflow is reliable, open Repository Settings and change the deployment mode to Automatic deployment.

Remote Git hostingCopy Plesk’s webhook URL into the remote repository and trigger it on push. Plesk can then pull and deploy the change automatically.
Direct push to PleskNo webhook is needed. A push to the active branch of the Plesk repository triggers deployment immediately.
Protect production access

Automatic deployment makes every accepted push a live release. Protect the remote production branch, and only give direct Plesk repository access to people authorised to deploy.

Roll back a faulty release

Revert the faulty commit locally, test the reversal and push it through the same deployment route. Use origin for remote Git hosting or plesk for a direct push.

git revert <commit-id>
git push <origin-or-plesk> main

For manual deployment, pull the revert into Plesk only when using remote Git hosting, then select Deploy from Repository. A revert preserves the history and avoids rewriting a production branch.