---
title: GitHub
description: Connect your site to a GitHub repository and keep the two in step, both ways.
sidebar:
  order: 13
---

Your site's code can live in a GitHub repository as well as in Vizitka. Once
connected, the site's branches and the repository's stay in step: what you or
your agent change in Vizitka goes to GitHub, and what is pushed or merged on
GitHub comes back and, on `main`, goes live.

If your site has no GitHub card on the **Integrations** screen, it isn't
available to that site yet.

## Connect it

The organization's owner and its admins connect, disconnect and press **Sync
now**. Every other member sees the card and how the sync stands.

1. On the **Integrations** screen, open GitHub's card and choose **Connect**.
2. Your browser opens. Press **Continue** and sign in on GitHub.
3. A Vizitka page asks you to confirm which GitHub account you connect to
   which site. Nothing is connected until you confirm. If the Vizitka app is
   not yet installed on any repository you can push to, the page links to
   GitHub to install it: choose the repository there, then connect again.
4. Back in the app, the card says to pick a repository. The list shows the
   repositories that account can push to. Picking one starts the first sync.

Pick an empty repository, or one whose `main` holds the site's own history,
for example one you pushed a clone of the site to. Vizitka never writes over a
repository that holds something else, and the card says so.

A public repository can be picked, after a warning. Everyone can then read
everything that syncs: every page and file of the site, every branch,
including each member's draft, and the message of every change. The rows of
your tables, such as enquiries, and the files on your
[Disk](/dashboard/disk/) never go to GitHub, public or private.

Anyone who can push to the repository can change your live site and add code
to it, such as an integration or a workflow that reads your private tables.
Give push access only to people you would invite to the site.

## What syncs, and how

- **Every branch, both ways.** A branch made in Vizitka appears on GitHub, and
  a branch pushed to GitHub appears in Vizitka. A site holds up to 50
  branches, and up to 20 of them can come from GitHub.
- **Drafts go out only.** Each member's draft goes to GitHub, so it can become
  a pull request, but nobody can change a draft from GitHub. A push to one
  there is replaced by the draft as it stands in Vizitka.
- **`main` goes live.** A push or a merge to `main` on GitHub goes live once it
  passes the same checks as any change to the site. A change to the site's
  tables is the exception: it waits in the app until someone presses **Go
  live** and approves what it does to the tables.
- **Merge commits are written again.** Vizitka keeps one straight line of
  history, so a merge commit from GitHub's merge button, from "Update branch"
  or from `git pull` is written again as one commit, and GitHub's branch is
  moved to match. Pull again before you push.
- **Conflicts go the site's way.** If GitHub and Vizitka both changed a branch
  and they parted, the site's version wins on both sides. GitHub's commits are
  kept there on a branch named `vizitka/replaced-` and a short code, so you
  can pick from them.
- **Each commit gets a check.** On every commit Vizitka judged, GitHub shows a
  Vizitka check: passed, failed with what was wrong on the lines of the files,
  or waiting for someone to approve it in the app. A pull request gets the
  check before you merge it. One from a fork has no branch in the site, so it
  gets none.
- **Go live in the app** puts a branch live and removes it, on GitHub too.
  GitHub then shows that branch's pull request as closed rather than merged.

A sync runs moments after a change on either side. **Sync now** runs one at
once.

## Tips

- Use **Squash and merge** or **Rebase and merge** on GitHub. A merge commit
  works, but it is written again, so your clone and GitHub's history differ
  until you pull.
- Turn on **Automatically delete head branches** in the repository's settings.
  A merged branch you leave on GitHub stays a branch of your site too.
- If `main` is protected by a ruleset or branch protection, add the Vizitka app
  to its bypass list. Otherwise Vizitka can't move GitHub's `main` to match
  the site, and the card says the branch is blocked. Changes still come in.
- `README.md`, `AGENTS.md`, `LICENSE` and the `.github/` folder are kept with
  the site but never read by it, so they don't change your pages. For now a
  `.vzk` file under `.github/` is refused.
- Branches whose names start with `vizitka/` stay on GitHub and never come in.

## Disconnect it

The owner or an admin chooses **Disconnect** on GitHub's card. That removes the
connection and the repository picked with it, and stops the sync. Nothing on
GitHub is deleted: the repository, its branches and its history stay there.
Removing the Vizitka app from the repository on GitHub stops the sync too, and
the card says so. Moving the site to another organization disconnects it,
though the number GitHub gives the repository picked stays in the site's
settings until someone there connects GitHub and picks again.
Otherwise the connection stays with the site until it is disconnected or the
site is deleted.

## A mirror to another git host {#own-mirror}

On plans that include integrations, your coding agent can write an integration
that keeps the site in step with a repository on another git host, such as
GitLab or Codeberg, with a token from that host you save on the
[Keys](/dashboard/integrations/#secrets) card of the Integrations screen. It
syncs branches the same way as GitHub, and starts only once the
organization's owner or an admin switches it on from its page on the
Integrations screen. Any host that answers over HTTPS at a public address
works.
