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.
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
main or master.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
- 1Open Git for the domain
Sign in to Plesk, open Websites & Domains, select the website and choose Git.
- 2Add the repository
Select Add Repository, then choose Remote Git hosting.
- 3Enter 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.
- 4Choose the target and deployment mode
Confirm the live directory, normally
/httpdocs, and select Manual deployment for the first release. - 5Clone 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
- 1Create the Plesk repository
Open Websites & Domains > Git, select Add Repository, then choose Local repository on your workstation.
- 2Name it and choose the target
Enter a repository name, confirm the live directory—normally
/httpdocs—and select Manual deployment for the first release. - 3Copy 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.
- 4Prepare 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
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.
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
- 1Check the branch and path
Use Change branch and path to select the branch you pushed and confirm the correct document root.
- 2Get 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.
- 3Deploy the files
Confirm that Plesk shows the expected commit, then select Deploy from Repository.
- 4Test 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"
git push origin main. In Plesk, select Pull Updates, review the commit and select Deploy from Repository.git push plesk main. The commit is already in Plesk, so review it and select Deploy from Repository; do not use Pull Updates.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.
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.