Deploy a website from GitHub
GitHub Deploy is available on Shared, Business, WordPress and Reseller Hosting plans. It deploys public or private repositories for PHP, Node.js, Laravel, static sites and custom applications.
GitHub Deploy works on custom websites on any plan; sites created with the one-click installer (WordPress, WooCommerce, OpenCart, Joomla) do not show the GitHub section.
Connect your GitHub account
Section titled “Connect your GitHub account”- Sign in to the control panel.
- Select GitHub connection in the left-hand menu, then Connect GitHub.
- Sign in to GitHub and complete the authorisation. Enhance creates a custom GitHub app under your GitHub account. Choose only the repositories you want it to access.
- Return to the control panel. GitHub connection now lists the repositories you allowed, each with a Deploy button.
Deploy a repository
Section titled “Deploy a repository”- In GitHub connection, select Deploy beside the repository, then To a new website or To an existing website. For an existing production or staging site, you can also open GitHub in that website’s top menu.
- For a new website, enter its domain and select Next.
- Under Branch or tag, choose what to deploy. Enhance takes a shallow clone, rather than the full repository history.
- If your project needs a build, enter it in Build script, for example
npm run build. Include any dependency installation your project requires. The command must finish with exit code0for the deployment to succeed. - If your site is served from a folder inside the project, enter it in Publish directory. For example, a static project that builds into
distwould usedist. Enhance sets the document root todeploys/current/<publish directory>. - Turn on Auto deploy on push to deploy every push to that branch or tag, or leave it off to deploy by hand.
- Under Persistent runtime (worker process), keep None for PHP and static sites, or choose Node.js, Laravel, PHP or Custom for an app that keeps running.
- Select Deploy.
The website’s GitHub page shows the connected repository and branch marker 1 and the auto deploy switch marker 2. Select Deploy now marker 3 to deploy by hand. Each deployment marker 4 shows its commit, when and how it started, View logs for the clone and build output, and View site.
For applications that need a running worker, the package must allow worker processes. Set it up with Configure under Worker processes on the website’s GitHub page; it restarts after each successful deployment. See Run a Node.js app for application startup and proxy settings, or contact support if the option is unavailable.
Automatic deployment on push
Section titled “Automatic deployment on push”With automatic deployment enabled, a push to the tracked branch or tag sends a GitHub webhook to the control panel and starts a deployment. Changes to other branches do not deploy that website.
Use a staging website to test the build and publish directory before connecting your production site.
Successful, failed and cancelled deployments
Section titled “Successful, failed and cancelled deployments”Every deployment gets its own deploys/<uuid> directory. The deploys/current symlink points to the latest successful deployment. Enhance switches that link only after the clone and any build command succeed, then restarts the website’s worker processes.
A failed or cancelled deployment leaves the currently served deployment unchanged. This protects the live file selection; it does not undo external changes made by your build command, such as database migrations. Back up your data before a deployment that changes it.
To cancel a clone or build that is still running, select Cancel beside it on the website’s GitHub page. Starting another deployment, manually or through a push, also cancels the one in progress.
Redeploy or return to earlier code
Section titled “Redeploy or return to earlier code”For a manual redeploy, select Deploy now on the website’s GitHub page. It clones the tracked branch or tag again and runs the configured build command.
To return to earlier code, deploy a branch or tag pointing to the version you want, or revert the change in GitHub and deploy again. This is a new deployment. A failed deployment preserving the live site is not a rollback of your application’s database or other persistent data.
Disconnect GitHub
Section titled “Disconnect GitHub”Disconnect the repository from the website’s GitHub section to stop deploying it. The website and its workers keep running, its files stay in place and deployment history remains. You can then connect a different repository or branch.
Disconnecting GitHub at account level disconnects every website using that connection.
Backups, staging and moving sites
Section titled “Backups, staging and moving sites”When website backups are enabled, they include Git deployment data and deployment history. GitHub connection details are not included. After a restore, check the connection and reconnect before deploying again.
Staging push-live, website cloning and moving a website between accounts do not copy GitHub connection details to the destination. Deployment history is retained. Check or reconnect GitHub on the destination before expecting automatic deploys.