Sites

Git Deploy & Rollback

Connect a GitHub or GitLab repository and deploy on push.

5 min read

Git Deploy & Rollback

GHP Cloud's Git deployment feature lets you connect a repository to your site and deploy by pushing to a branch. Every deploy is atomic and can be rolled back to any previous state in seconds.

Connecting a repository

1. Open your site and click the Deployments tab

2. Click Connect Repository

3. Choose your Git provider: GitHub, GitLab, or Bitbucket

4. Authorise GHP Cloud to access your repositories (OAuth flow)

5. Select the repository and branch to deploy from

6. Set the Deploy path — this is the directory inside your repository that contains the web root (usually / or /public)

7. Click Connect

GHP Cloud adds a deploy key (read-only SSH key) to your repository automatically.

Automatic deployment on push

Once connected, every push to the configured branch triggers an automatic deployment. GHP Cloud receives a webhook from your Git provider, pulls the latest commit, runs any configured build commands, and atomically switches the web root to the new release.

The deployment log shows each step in real time:

[12:34:01] Fetching latest commit from main...
[12:34:02] Commit: a3f91bc — "Update footer design"
[12:34:02] Running build commands...
[12:34:05] npm ci --prefix ./
[12:34:18] npm run build
[12:34:25] Switching web root to release #47
[12:34:25] Deployment complete ✓

Build commands

If your project requires a build step (e.g., a JavaScript theme), configure build commands in Deployments → Build Settings:

bash
npm ci
npm run build
composer install --no-dev

Build commands run on your server using the PHP-CLI and Node.js versions available. Ensure those versions match your local environment.

Rolling back

Every successful deployment is stored as a numbered release. To roll back:

1. Click Deployments → History

2. Find the release you want to restore

3. Click Roll Back

GHP Cloud atomically switches the web root back to that release's files. The rollback takes under 5 seconds and requires no downtime.

Manual deployment

If you want to trigger a deployment without pushing to Git, click Deploy Now on the Deployments tab. GHP Cloud pulls the latest commit from the connected branch and runs a full deployment.

Was this article helpful?

Need help? →