Plesk

Deploy a website from Git in Plesk (GitHub, GitLab, Bitbucket)

Connect a remote Git repository to a Plesk domain, deploy automatically or manually with a webhook, set the deployment path and run build commands after each push.

IntermediatePlesk3 min read

The Git extension in Plesk pulls code from a repository and deploys it to your website's folder. With a webhook, every push to your branch updates the live site automatically, so you no longer need to upload files by FTP. This guide uses GitHub, but GitLab and Bitbucket work the same way.

Before you start

  • The Git extension is installed (administrators: Extensions → Extensions Catalog → Git).
  • A repository on GitHub, GitLab or Bitbucket and permission to add deploy keys and webhooks.
  • A domain in Plesk whose document root you are happy to overwrite.

Add the repository

  1. Go to Websites & Domains and click Git under the domain.
  2. Choose Remote Git hosting.
  3. Paste the repository's SSH URL, for example git@github.com:user/site.git. Use HTTPS only for public repositories.
  4. Plesk shows a public SSH key. Copy it.
  5. In GitHub, open the repository's Settings → Deploy keys → Add deploy key, paste the key, keep it read-only and save.
  6. Back in Plesk, set the Repository name.

Choose deployment settings

  • Deployment mode:
    • Automatic – deploy on every push received by webhook.
    • Manual – deploy only when you click Deploy now.
    • No deployment – keep the repository on the server without copying files.
  • Server path: usually /httpdocs. If your repository contains a public folder, deploy to a separate folder and point the document root to it under Hosting & DNS → Hosting.
  • Click Create. Plesk clones the repository and does the first deployment.

Set up the webhook

  1. In Plesk, open the repository settings and copy the Webhook URL.
  2. In GitHub, go to Settings → Webhooks → Add webhook.
  3. Paste the URL, set Content type to application/json and select Just the push event.
  4. Save. GitHub sends a test ping; a green tick means Plesk received it.

Run commands after deployment

Open the repository in Plesk, click Repository Settings and tick Enable additional deployment actions. Enter one command per line, for example:

composer install --no-dev --optimize-autoloader

Commands run as the subscription user in the deploy directory. If you need Node.js builds, install the Node.js extension and use its full path. Keep build steps quick; long-running actions can make deployment look stuck.

Switch branches and roll back

  • Change the deployed branch in Repository Settings → Branch.
  • To roll back, revert the commit in Git and push; Plesk deploys the reverted state. The Plesk interface also lists recent commits so you can confirm what is live.

Troubleshooting

  • Permission denied (publickey): the deploy key was not added, or you used the HTTPS URL for a private repository.
  • Webhook returns 404 or 403: copy the webhook URL again; it contains a unique token. A firewall or WAF blocking GitHub IPs can also cause this.
  • Files not updated: check the server path; files you created manually in that folder are not removed, and some may conflict.
  • Secrets in the repository: never commit .env or wp-config.php. Create them on the server once and add them to .gitignore.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.