Git deploy
The Git Deployment menu connects a Git repository to a folder in your account. One branch is pulled into the target folder, an optional build command runs, and deploys can run automatically every time you push.
When this menu is available
The Git Deployment menu appears when your hosting package includes the Git feature. If it is missing, contact your hosting provider or upgrade your package.
How it works
- Deploys run as your account's user in an isolated environment, within the account's resource limits.
- The latest version of the branch is fetched, then the files in the target folder are updated:
- files tracked by the repository are overwritten;
- files deleted in the repository are deleted too;
- untracked files, e.g.
wp-content/uploadsor.env, stay.
- Submodules are updated too if the repository uses them.
- Git metadata is stored outside the web folder, so a
.gitfolder never exists inpublic_htmland the repository content cannot be downloaded through a browser.
| Limit | Value |
|---|---|
| Duration of one deploy | 15 minutes |
| Repositories per account | 20 |
| URL protocols | https, http, ssh |
Connecting a repository
Click Connect repository.
Fill in the form:
Field Notes Repository URL HTTPS for public repositories, e.g. https://github.com/jane/myshop.git. SSH for private repositories, e.g.git@github.com:jane/myshop.git.Branch The branch to deploy. Default main.Deploy to (in home) The target folder relative to your home folder, e.g. public_htmlorpublic_html/blog.Name (optional) The repository name in the panel. Empty means it is taken from the URL. Post-deploy command (optional) Runs in the target folder after the files are updated, e.g. composer install --no-devornpm ci && npm run build.Deploy automatically on push (webhook) Tick to deploy automatically on push. Deploy now Tick to deploy right after connecting. Only shown for non-SSH URLs, because SSH repositories need a deploy key first. Click Connect.
After connecting, the Connect … dialog shows the deploy key and the webhook URL. For a private repository, add the deploy key first, then press Deploy.
Target folder that already has files
Files in the target folder that also exist in the repository will be overwritten. Back up the folder first, or deploy to an empty folder.
Private repositories: deploy key
Public HTTPS repositories need no key. For a private repository:
- Use the SSH URL, e.g.
git@github.com:jane/myshop.git. - Open Key & webhook on the repository row.
- Copy the Deploy key (public).
- Add that key as a read-only deploy key in the repository:
- GitHub: Settings › Deploy keys;
- GitLab: Settings › Repository › Deploy keys.
- Click Deploy in the panel.
Each repository has its own key created by the panel. The private key stays in your account and is never shown.
Manual deploys
Click Deploy on the repository row. The status changes to Deploying, then to Deployed or Failed.
Click Log to see the deploy output, including the output of the post-deploy command. The log updates while the deploy runs.
The repository table also shows Deploys to and Last deploy, with the commit, commit message, time, or error message.
Automatic deploys with a webhook
- Make sure Deploy automatically on push (webhook) is on. Change it with Edit if needed.
- Open Key & webhook and copy the Push webhook URL.
- Add that URL as a push webhook at your Git host with the content type
application/json.
Example on GitHub:
- Open the repository › Settings › Webhooks › Add webhook.
- Enter the webhook URL from the panel as the Payload URL.
- Choose the Content type
application/json. - Choose the Just the push event event.
- Save.
The webhook works with GitHub, GitLab, Gitea, and Bitbucket.
- A push to the chosen branch triggers a deploy automatically.
- Pushes to other branches are ignored.
- While a deploy is still running, further pushes do not pile up new deploys.
- The deploy column in the table is marked auto for repositories with automatic deploys.
The webhook URL is secret
Anyone who knows the webhook URL can trigger a deploy. If the URL leaks, click Replace webhook URL in Key & webhook. The old URL stops working right away, so update the webhook at your Git host with the new URL.
Editing and disconnecting a repository
- Edit: change the URL, branch, target folder, post-deploy command, or automatic deploys, then Save.
- Disconnect: removes the repository from the panel. The Git metadata and deploy key are deleted, but files already deployed to the target folder stay.
