---
title: "Deploy from GitHub: git push to deploy"
description: "Connect a GitHub repo so every push to the tracked branch builds and redeploys, including private repos, branch switching, and monorepos."
url: https://lizard.build/docs/deploy/github/
updated: 2026-11-11
---

# Deploy from GitHub

Connect a GitHub repository for git push to deploy: Lizard builds and redeploys your app whenever you push to the tracked branch. Run `lizard add -r owner/repo` to create the service; for a private repository, connect the Lizard GitHub App first with `lizard git connect`. This is the recommended way to run an app you keep in GitHub. For code with no remote, [deploy from local code](https://lizard.build/docs/deploy/upload.md) instead.

## Create a service from a repo

```bash
lizard add -r your-org/your-app
```

This creates a `github`-source service and starts the first build in the background: Lizard clones the repo and detects the stack ([lizardpack](https://lizard.build/docs/concepts/build-pipeline.md)). The command prints no URL. Follow the build with `lizard logs --build --service <name>`; once it is live, `lizard ps` shows the URL. Useful flags:

| Flag | Purpose |
|------|---------|
| `-r, --repo <owner/repo>` | Source repository |
| `-n, --name <name>` | Service name (used in `${{name.KEY}}` refs and the dashboard) |
| `-v, --variables <K=V>` | Seed an env var; repeatable |
| `--region <code>` | Region to deploy in (default `us-east-1`) |
| `--no-deploy` | Attach the repo but skip the first build |

## Private repositories

Connect the Lizard GitHub App once per account to grant access to private repos:

```bash
lizard git connect
lizard git status        # show connection + repo status
```

You can also connect and manage repository access from the **GitHub integration** page in the dashboard (`lizard open`).

## Point an existing service at a repo

To switch a service to a git source (or change the repo/branch):

```bash
lizard service set api \
  --set sourceType=github \
  --set repoUrl=https://github.com/your-org/your-app \
  --set branch=main
```

Changing a build field rebuilds a running service. Running `redeploy` afterward [cancels that build and starts another](https://lizard.build/docs/deploy/troubleshooting/double-build.md). A crashed or never-deployed service needs `lizard redeploy`.

> **Note:** `lizard up` always forces `sourceType=upload`. Don't use it to update a git-backed service: push to the remote or use `lizard redeploy` instead. In a folder with no linked service, `up` picks the service named after the folder or `package.json`, so in a clone of the repo it can switch your GitHub service to an upload.

## Auto-redeploy on push

Once `repoUrl` is set, pushes to the matching `branch` redeploy automatically via the GitHub webhook. Connect the Lizard GitHub App (`lizard git connect`) so Lizard receives push events for the repository. To scope which pushes trigger a redeploy:

- **`rootDirectory`**: only build a subdirectory (monorepos).
- **`watchPatterns`**: only redeploy when matching paths change.

```bash
lizard service set api --set watchPatterns='apps/api/**,packages/**'
```

To stop pushes from deploying, turn off **Auto-deploy** in the service's settings in the dashboard. A [paused](https://lizard.build/docs/cli/pause.md) service also ignores pushes until you resume it.

## Switch branches

```bash
lizard git checkout api staging      # move the `api` service to the `staging` branch and redeploy
```

## Monorepos

For a repo that holds several apps, create one service per app and set its `rootDirectory` to the subpath:

```bash
lizard add -r your-org/monorepo -n api --no-deploy
lizard service set api --set rootDirectory=apps/api
lizard redeploy --service api
```

If your current directory is a sub-app inside a repo whose parent is already linked, add the service in the parent's project and set `rootDirectory` to the cwd subpath.

## See also

- [Build Pipeline](https://lizard.build/docs/concepts/build-pipeline.md): how your stack is detected and built.
- [Framework guides](https://lizard.build/docs/framework-guides.md): build commands and ports for [Next.js](https://lizard.build/docs/framework-guides/nextjs.md), [Nuxt](https://lizard.build/docs/framework-guides/nuxt.md), [Django](https://lizard.build/docs/framework-guides/django.md), [FastAPI](https://lizard.build/docs/framework-guides/fastapi.md), [Rails](https://lizard.build/docs/framework-guides/rails.md), [Go](https://lizard.build/docs/framework-guides/go.md) and more.
- [Deploy with a Dockerfile](https://lizard.build/docs/deploy/dockerfile.md): when the repo has its own Dockerfile.
- [Deploy from Local Code](https://lizard.build/docs/deploy/upload.md): when you don't have a remote.
- [`lizard git`](https://lizard.build/docs/cli/git.md): the full command reference for `connect`, `status`, and `checkout`.
- [Choose the host by the application](https://lizard.build/blog/google-antigravity-how-to-deploy-your-app-to-production#choose-the-host-by-the-application): choosing a host for an app an agent wrote.
