Hanzo
OpenapiGit

Imports an external git repository into the caller's repo, provisioning it on…

Imports an external git repository into the caller's repo, provisioning it on first use.

POST /v1/git/repos/{name}/mirror

Addresshttps://api.hanzo.ai/v1/git/repos/{name}/mirror
MethodPOST
Operationpost_git_repos_by_name_mirror
AuthAuthorization: Bearer $HANZO_API_KEY

Imports an external git repository into the caller's repo, provisioning it on first use. Fetch is FORCED and covers every ref, so a first call clones the source and a repeat call re-syncs it — the endpoint is idempotent by mirror semantics. Mirrored bytes are metered exactly like a push, and a push.landed event is emitted for the default branch so the code index picks the repo up.

Request

4 fields, body application/json (required).

FieldInTypeRequiredDescription
namepathstringyesName is the local repo to mirror into, from the :name path segment.
namebodystringName is the local repo to mirror into, from the :name path segment.
projectbodystringProject is the sub-scope to land the repo in; empty uses the caller's own, exactly as a create would.
sourcebodystringSource is the http(s) git URL to fetch from.

Response

StatusBodyMeaning
200repoViewok

200 body — 14 fields.

FieldInTypeAlwaysDescription
branchesbodystring[]Branches are the repo's branch names.
cloneUrlbodystringCloneURL is the HTTPS smart-HTTP remote git clone takes.
createdAtbodystringCreatedAt is RFC 3339 UTC.
defaultBranchbodystringDefaultBranch is where HEAD points on a fresh repo ("main").
descriptionbodystringDescription is the caller-supplied blurb (max 4KiB).
headbodystringHead is the resolved HEAD commit, empty on an empty repo.
idbodystringID is the repo's stable, prefixed identifier ("repo_" + 128 random bits).
namebodystringName is the org-unique handle, and the last path segment of both URLs below.
orgbodystringOrg owns the repo — the gateway-minted X-Org-Id, and the isolation key.
projectbodystringProject is the optional sub-scope the repo lives in; absent for the org's default scope.
publicbodybooleanPublic grants ANONYMOUS read (fetch) only; push and the whole control plane stay org-authed.
sizeBytesbodyintegerSizeBytes is the repo's measured on-disk size, re-measured on create, after each push, and after a gc.
sshUrlbodystringSSHURL is the scp-style SSH remote (git@host:org/repo.git).
updatedAtbodystringUpdatedAt is RFC 3339 UTC, empty until the first write.

Failure carries the platform error shape — see Errors.

Examples

hanzo git repos mirror <name>

Git API · All Hanzo APIs · Interactive reference

How is this guide?

On this page