Skip to main content
Code Storage can keep a repository in sync with a named Git host that uses HTTPS authentication. Your tools, automations, and users still use the Code Storage remote. Use Generic Sync when you want to:
  • Mirror a repository from GitLab, Bitbucket, Gitea, Forgejo, Codeberg, or SourceHut
  • Push to Code Storage and let Code Storage forward those writes to the upstream host
  • Continue to use Code Storage APIs, JWT-backed remotes, ephemeral branches, and webhooks on the mirrored repository

Sync modes

Code Storage currently supports three Git Sync modes: This page covers Generic HTTPS Git. For GitHub, see GitHub Sync.

Supported providers

Generic Git Sync supports named providers that authenticate over HTTPS with a username and password, or with a token:
  • gitlab
  • bitbucket
  • gitea
  • forgejo
  • codeberg
  • sr.ht or sourcehut
For some providers, Code Storage can derive the public upstream host automatically:
  • gitlab -> gitlab.com
  • bitbucket -> bitbucket.org
  • codeberg -> codeberg.org
  • sr.ht -> git.sr.ht
Set upstream_host for each self-hosted provider. Also set it for providers with no fixed public host, such as gitea and forgejo. Generic HTTPS Git sync does not support Git LFS.

Generic Git setup

Generic provider setup happens in three steps:
  1. Create the Code Storage repository with a generic Git base.
  2. Store the HTTPS credential for that repository.
  3. Start the initial pull.

1. Create the synced repository

This example creates a Code Storage repository with GitLab as its base. For a self-hosted GitLab instance, include upstreamHost / upstream_host.
For a self-hosted provider, add upstreamHost / upstream_host:
The response includes the internal repo_id. Use that value in the next step.

2. Store the Git credential

Create a credential record for the repository. Providers that accept a token alone do not need username.

3. Trigger the initial pull

How Git Sync behaves

After you configure Git Sync, these rules apply:
  • git clone, git fetch, and git pull read from Code Storage
  • repo.pullUpstream() and POST /api/repos/{repo_name}/pull-upstream start an asynchronous refresh from the configured provider
  • Code Storage forwards each git push to the external Git host
  • A successful push starts a background sync to keep the Code Storage nodes current
Your app can use Code Storage as its stable endpoint. Code Storage still copies changes to and from the external host. Only pushes to the normal remote reach the external host. Pushes to the +ephemeral remote stay in Code Storage. A sync from the external host copies only refs/heads/* and refs/tags/*. Put machine state on ephemeral branches to keep it out of the upstream repository. Machine state includes agent snapshots, preview builds, and scratch commits.

Support

For help, email jacob@pierre.co.