Deploy from GitHub
Link a repository and a branch to one of your apps, and every push to that
branch builds and deploys it. A git deploy is an ordinary deploy — the same
build settings, the same limits, the same deployment history and the same
rollbacks as ghayma deploy.
The link is per app: one site is bound to one
repository + branch. A project with several apps links each one separately,
and several apps may deploy from the same repository.
Connect your GitHub account
Open the app’s Git panel
In the console , open your project → the site → Connections. The Deploy from GitHub panel sits under the connected services.
Install the Ghayma Deploy app
Click Connect GitHub. You land on github.com, where you install the Ghayma Deploy app on your personal account or on an organization, and choose which repositories it may see — all of them, or a list you pick.
The app asks for read access to the contents and metadata of those repositories, and for push events. It cannot write to them, and it sees nothing you did not select.
Come back to the console
GitHub sends you back and the account is connected. The connect link is good for 15 minutes — if you take longer, start again from the Git panel.
Installing on an organization you don’t own asks an owner to approve the app instead. Nothing is connected until they do; come back to the Git panel afterwards and link the repository.
Link a repository and a branch
With an account connected, the panel shows a picker:
| Field | What it does |
|---|---|
| GitHub account | Only shown when you have connected more than one account or organization |
| Repository | The repositories that installation may read. Private ones are marked (private) |
| Branch | Defaults to the repository’s default branch — type another to deploy from it instead |
| Deploy automatically on every push to this branch | On by default. Off means the link exists but pushes build nothing |
Click Link repository. The panel then shows the repository, the branch and an auto-deploy on chip, plus the account the link goes through.
Linking needs the project write role — a link is a standing permission to deploy, so it is the same bar as a deploy itself. With read you see the link but cannot change it.
One repository link per app. Linking again replaces the existing link rather than adding a second one, so switching branch or repository is just linking again.
What happens on a push
A push to the linked branch creates a deployment immediately:
- The commit’s code is fetched and built with the app’s build settings.
- The commit’s first line becomes the deploy message.
- The deployment appears on the project’s Deployments tab with a git push badge next to the short commit sha, the branch and the repository.
- It is a production deploy when the linked site is a production site — the same rule every other deploy follows. Link a development site’s repository and its pushes are development deploys.
Everything else about it is an ordinary deploy: it waits its turn in the build queue, it counts against your plan’s daily deployment limit, a failed build leaves the previous one serving, and you can roll back to it or from it.
Only the linked branch deploys. Pushes to any other branch, tag pushes, and branch deletions are ignored — nothing is built and nothing is charged.
Git deploys run as the person who linked the repository, not as whoever pushed: the pusher is a GitHub identity with no Ghayma account behind it. The pusher’s login and the commit are still recorded on the deployment.
Where the build settings come from
A git deploy carries no .ghayma.json — that file is read by the CLI on your
machine, not from inside the repository. A pushed build uses:
- the settings saved on that site (the site’s Settings page), then
- auto-detection.
So for a monorepo, set the site’s root directory in its Settings before
linking — otherwise detection sees the workspace root and the build fails. The
same goes for an app that builds from its own Dockerfile: Build with: My
Dockerfile has to be saved on the site (see Custom
Dockerfile). A previous ghayma deploy will already
have written its .ghayma.json build fields onto the site, in which case there
is nothing to do. See Where build
settings live.
For the same reason, a git deploy never touches your cron
jobs — the crons array is applied by ghayma deploy only.
Several apps from one repository
The same repository — and the same branch — may be linked to as many apps as you like. That is how a monorepo deploys: each site carries its own root directory, and one push deploys all of them, one after another, from the same commit.
Private repositories
Private repositories work exactly like public ones. The app’s installation is what grants read access: the platform mints a one-hour token per fetch and drops it, and no user token, password or SSH key is ever stored. Your source is downloaded for the build and treated like an uploaded tarball — nothing of the repository is kept beyond the build.
Deploy on demand
A linked site can be deployed from its repository whenever you ask, without a push:
POST /api/v1/projects/:id/sites/:siteId/repo/deployBody (optional):
{ "sha": "9f2c1b8e4a7d0c3f6b5e2a1d8c7b4f3e0a9d6c2b" }With no body — or no sha — the linked branch’s head is resolved live from
GitHub and deployed, and that commit’s message becomes the deployment’s label. A
sha deploys that exact commit instead; it must be a 40-character hash.
Response: 202
{ "deployment": { "id": "dpl_abc123", "status": "queued" } }The fetch and the build run in the background, so poll Get
Deployment for the outcome — a GitHub-side
failure lands on the deployment row as failed, with the reason in the build
logs, exactly like any other failed deploy.
auto_deploy is ignored. That switch says whether a push deploys itself;
this route is a person or an orchestrator asking. A link with auto-deploy off
deploys here perfectly well — which is the whole point of turning it off.
The deployment is tagged with the git_manual trigger, so the history tells an
on-demand deploy apart from a pushed one. It is an ordinary deploy in every
other respect: the build queue, the daily limit, the rollback window.
| Status | Code | Meaning |
|---|---|---|
400 | — | sha is not a 40-character commit hash, the per-day deploy cap is used up, or the project is suspended |
403 | — | You lack the project write role, or your write access is restricted to other sites |
404 | no_repo_linked | No repository is linked to this site |
409 | installation_revoked | The GitHub installation behind the link was removed |
502 | — | GitHub could not resolve the branch |
This route takes an account token or a dashboard session. A
project API key answers 403: a key that could deploy a
site’s linked branch could run arbitrary code as that site’s owner.
Turning auto-deploy off
Turn off auto-deploy keeps the link and stops building. Pushes to the branch
are recorded on the panel and nothing else happens, and you can still deploy
that app with ghayma deploy — or on demand — meanwhile.
Turn on auto-deploy puts it back.
Unlinking
Unlink asks once, then removes the link:
Stops deploying on push. Deployments already made stay as they are.
Nothing else changes. The app keeps running its current build, every past deployment stays where it is, and you can deploy it from the CLI or link another repository whenever you like.
Removing the Ghayma Deploy app on GitHub stops deploys immediately — for every app linked through that installation, and without warning here. GitHub simply stops sending the pushes. Reinstalling creates a new installation, so you have to link each app’s repository again afterwards. To remove it from the Ghayma side, with the links cleaned up for you, use Uninstall instead.
Managing your installations
Settings → GitHub in the console lists every GitHub account and organization
you have installed the app on: the account login and type, when you connected
it, how many linked sites run through it, and a revoked chip once the
installation is gone from GitHub.
Uninstall
Uninstall takes the whole installation out, on both sides, after a two-click confirmation showing what it will unlink:
- The app is removed on GitHub.
- Every site linked through that installation is unlinked — the sites keep running their current build and their deployment history is untouched.
- The installation is marked revoked here.
DELETE /api/v1/github/installations/:installationIdResponse: 200
{ "removed": true, "unlinked_sites": 2, "github_uninstalled": true }GitHub is called first: if it refuses, nothing local changes and the call
answers 502 github_uninstall_failed — the message tells you to retry or
uninstall from GitHub → Settings → Applications. The reverse order would
leave your links deleted for an app that is still installed.
| Status | Code | Meaning |
|---|---|---|
200 | — | Removed. unlinked_sites is how many links went with it |
404 | — | Unknown installation, or not one you connected |
502 | github_uninstall_failed | GitHub refused; nothing local changed |
503 | — | GitHub deploys are not configured on this platform |
It is idempotent and forgiving: uninstalling twice answers 200 with
unlinked_sites: 0, and if you already removed the app on github.com you can
still call this to clear the links it left behind — which is the main reason to.
One installation, one Ghayma account
A GitHub installation belongs to the Ghayma account that connected it. If someone else runs the install flow for the same installation, they are refused:
{
"code": "installation_claimed",
"error": "this GitHub installation is already connected to another Ghayma account; uninstall it there first (Settings → GitHub) or install the app on a different GitHub account"
}Re-running the flow as the same account is fine — it is idempotent. To move an installation to another Ghayma account, uninstall it from the first one; a revoked installation is claimable by anyone again.
When a push doesn’t deploy
The Git panel keeps the outcome of the last push — Last push 4 minutes ago — deployed, ignored, or a red Last push failed: …. Work down this list:
| What you see | What to check |
|---|---|
| Nothing at all on the panel | The push went to another branch, or GitHub no longer has the app — check the branch on the link, and the app’s installation on github.com |
auto-deploy off chip, ignored | Turn auto-deploy back on |
Last push failed: deploy refused | The person who linked the repository lost the project write role — or their write access is restricted to other sites — the project is suspended, or the plan’s daily deployment limit is used up. Relink as someone with write access on this site, or wait out the limit |
Last push failed: fetch | The commit could not be downloaded — usually the repository was removed from the installation on GitHub. Add it back, then push again |
| A failed deployment with logs | The build itself failed. Read the log on the Deployments tab like any other failed deploy — see Builds |
A push whose repository was renamed on GitHub still deploys: the link follows the repository’s id, not its name.
If the panel says GitHub deploys are not configured on this platform yet, the platform this console belongs to has no GitHub app set up. Nothing you can fix from here — deploy with the CLI meanwhile.
Related
- Builds — the queue, the limits, and why a build fails
- Deploy & Manage —
ghayma deploy, rollbacks, and.ghayma.json - Sites — several apps in one project
- Environments — what makes a pushed deploy a production one