Live deploy
Deploy a Git repository's live branch to your website automatically on every push.
Live deploy turns a Git repository into automatic deploys. Its live branch (main by default) deploys to one of
your websites whenever it gets a new commit. Each deploy runs your deploy script, and its output is kept as the build
log.
Where: Control Panel › Software › Git › Live deploy (on a repository's row, or in an open repository)
Set it up
- On the Git page, click Live deploy on the repository's row.
- Fill in Settings and click Save:
| Field | What it does |
|---|---|
| Live website | the website the live branch deploys to (into its folder). None = no live deploys. |
| Live branch | the branch that deploys live; main when empty |
| Deploy script | shell commands run as your account in the copied folder after each deploy, for example composer install --no-dev or npm ci && npm run build. Up to 4,000 characters, 15 minutes at most. HF_BRANCH and HF_COMMIT are set. |
Pushes are picked up within 5 minutes. Click Check for pushes now to deploy straight away. A cloned repository is fetched from its remote first; for a repository on this server, its own branches are used.
The last deploy
The Last deploy card shows the live branch, the website, the status (Ready or Failed), the commit, when it was last deployed and when the repository was last checked, with the Build log. Deploy now deploys the live branch again even when it has no new commit.
A deploy copies the branch's files (never .git) over the website's folder; files the branch doesn't have, such as
uploads, are kept. Then the deploy script runs. If the script fails the files stay copied and the status is
Failed — read the build log.
Note: the deploy script runs as your account, like a cron job. Keep secrets out of the repository: put them in files the script reads, or in the app's own settings.