git push, this is that flow: add your server as a git remote, push, and the app builds and deploys the commit you pushed. There is no git provider, webhook or SSH key involved: the control plane speaks git over HTTPS on the address you already use for the dashboard.
Turn it on
- Open Settings, Beta features and switch on Git push deploy (or add
git-pushtoAPP_EXPERIMENTAL). It applies at once, no restart. - Create the app first. An empty app made with
levelrail-cli apps createor the dashboard is enough. - Enable the remote for that app, from the CLI or the app’s Source tab.
--apply (to git remote add or git remote rotate) to let the CLI set the remote in the current repository, or in --dir PATH, for you. It runs git remote add, or git remote set-url when a remote with that name already points at this app’s address. If the name is taken by a remote that points somewhere else, it stops and changes nothing. By default the token is kept out of .git/config (see the tip below). Pass --store-token-in-config to write the token URL into .git/config instead; it is then stored unencrypted in the repository config and anyone who can read that repository can read it. If git or the repository is missing, the command prints the line above so the one-time token is not lost. --apply is unit tested with fakes (cmd/levelrail-cli/git_remote_test.go) and has not run against a live control plane.
On the Source tab the card shows the remote, a copy button, the deploy branch, the last push and the rotate and revoke buttons.
With --apply the token stays out of .git/config by default (--credential-helper is still accepted and does nothing extra). The remote URL is written with the user name only, and a fixed git credential helper for this server reads the token from the LEVELRAIL_GIT_TOKEN environment variable at push time. The one-time token is printed once so you can export it, and the command refuses a server URL whose host differs from the API address. rotate --apply also replaces any remote URL an older version wrote with the token inline. Without --apply nothing changes: the command prints the add line. This is unit tested with fakes and has not pushed to a live git server.
What a push does
A push to the deploy branch (main by default) is received, stored, built and deployed. The build output comes back to your terminal as remote: lines, so you see what the dashboard sees.
- The image is tagged by the pushed commit, and the deploy shows in the app’s deploy history with the commit, message and author. Rollback works as for any other deploy.
- If the build fails, git shows
[remote rejected] ... deploy failed, the previous release keeps running, and the branch on the server does not move. After fixing the build, run the samegit pushagain. - A Dockerfile at the repository root is built as a Dockerfile, anything else with Railpack. If the app has a connected git source its build settings are used instead.
- With no
app.yaml, a first push of a repo that has aProcfiledeploys each process type as a service. Anapp.jsonnext to it supplies healthchecks,formationreplica counts andscripts.dokkupre and post deploy hooks. Any otherapp.jsonkey is reported as a warning in the deploy result, never dropped silently. An app that already deployed keeps its single service. To run several process types by hand, describe them as services inapp.yaml;levelrail-cli import configturns aProcfileinto a first draft. See Buildpack apps. - One deploy per app at a time. A push during a running deploy or a deploy freeze is refused with a message.
Tokens
- One token per app, shown once, stored only as a SHA-256 hash.
- The token can do one thing: push to that app. It cannot read the app, list anything or call the API.
levelrail-cli git remote rotate my-appissues a new token and the old one stops working at once.revoketurns the remote off.- Wrong or missing tokens always answer the same way, requests are rate limited, and repeated bad tokens back off. Every push outcome is written to the audit log.
- Creating, rotating, changing the branch and revoking need the
write_sensitiveability on the app.
GitHub App access for stored sources
Git sources set by a team scoped user no longer clone with the connected GitHub App (app_auth is false). Multi-team admins should review stored git sources after upgrading: existing sources keep App access.
Submodules and LFS
Builds skip git submodules and LFS objects unless you turn them on per app. The toggles apply to push deploys only; preview and branch deploys (including pull requests from forks) never fetch submodules or LFS objects.PUT /api/v1/apps/{name}/git-source/deploy-settings (fetch_submodules, fetch_lfs). Changing them needs the same access as other git source settings.
- Submodule URLs must be
https://, or a./or../path relative to the app’s repository that stays on its host.ssh,git://,file://, and URLs with a user name or password are refused, and the build fails with the module name. - A submodule path must stay inside the checkout: absolute paths,
..,.gitand symlinked directories are refused. - The app’s git credentials go only to the repository’s own host. A submodule on another host is fetched anonymously unless an admin lists that host in
git.submodules_credential_hosts. A private submodule without access fails with a clearsubmodule needs credentialserror that names the host. - LFS objects download only from the repository’s host. If your git server redirects downloads to a storage host, list it in
git.lfs_hosts; the app’s credentials are never sent there. Each object is checked against its pointer’s size and hash. - Submodule and LFS hosts must resolve to public addresses. Loopback, private, link-local, CGNAT, multicast and unspecified addresses are refused at connect time; an admin can allow a self-hosted git server’s network in
git.submodules_allowed_cidrs. Any network failure is reported assubmodule host unreachablewith the host name; the cause is in the server log. - Runtime settings cap each build:
git.submodules_max_depth(nesting),git.submodules_max_count,git.submodules_max_mb(checkout plus submodules plus LFS) andgit.submodules_timeout. They apply to the next build.
Limits
What it does not do:
- It is not a git host. There is no repository browser, history view or pull request, and
git cloneandgit fetchare refused. - No Git LFS, no SSH, no Compose apps, no per-branch environments.
- Anyone with the token can deploy that app. Treat it like a deploy key, rotate it when someone leaves.
- It needs the source cache directory, which every normal install has. Without it the endpoints answer 501.
- The control plane must be reachable over HTTPS from where you push. Over plain HTTP the token travels in clear text, so use the HTTPS dashboard address.
Troubleshooting
The API is
GET, POST, PUT and DELETE on /api/v1/apps/{name}/git-remote, listed in the API reference. The design and the alternatives that were rejected are in ADR 040.