archil.git on the Archil client, in both SDKs: the
disk package for TypeScript and the archil
package for Python. There is no separate package to install. To set up Git hosting first, see the
quickstart.
Git hosting is in preview, and the API may change before 1.0.
Configure
archil.git uses the client’s API key and your git endpoint, which the console shows on its Git hosting page.
Use an API key from the workspace where Git hosting is enabled. Without an endpoint, every
archil.git call fails with
code not_configured before sending a request.
In Python every method also has an async form, .aio, like the rest of the SDK:
Edge runtimes
In TypeScript,archil.git runs in edge runtimes such as Cloudflare Workers and Vercel Edge Functions as well as in
Node.js. It makes only HTTPS requests to your git endpoint with fetch, and verifies webhooks with Web Crypto.
Repos
Python uses snake_case:
default_branch, list_page, next_cursor, and cascade=True.
A repo has these fields:
Tokens
git and Git LFS accept only tokens you mint, never your API key. A token names the repos it opens, a scope, and a
lifetime of up to 24 hours. A read token can clone, fetch, and download LFS objects. A write token can also push and
upload LFS objects.
git a token. All three helpers are exported from disk and from archil.git:
gitEnv sets GIT_CONFIG_COUNT and replaces any GIT_CONFIG_* variables already in that environment.
Any HTTPS git client works with a token as the password of HTTP basic auth: the username is ignored. A request with an
API key, or with an expired token or one for another repo, is refused.
Read API
Read refs, trees, files, history, and diffs over HTTPS, without cloning. Each method is on aRepo, and also on
archil.git.repos with the repo ID first, such as archil.git.repos.blob(id, "main", "README.md").
A
ref can be a branch, tag, or commit, and may contain slashes.
Commits, forks, and webhooks
Shards
The git service spreads repos over shards, 4 by default. Each shard is a sandbox in your account that serves the repos placed on it, and starts when the first repo is placed there. More shards spread pushes from many concurrent clients over more sandboxes.Errors
Failed calls throwArchilGitError, exported from disk and from archil.git. In TypeScript it’s an ArchilError
like every other SDK error. It carries:
Other failures carry the code the service sends. When it sends none, the code follows the HTTP status:
bad_request (400), unauthorized (401), forbidden (403), not_found (404), conflict (409),
payload_too_large (413), rate_limited (429), and server_error (5xx). Branch on status for these. A 502 or 503
means the git service is starting or waking up: retry the call.
WebhookVerificationError. See Push webhooks.