Skip to content

Git protocol

Artifacts exposes Git access for every Artifacts repository.

Each repo has a standard Git smart HTTP remote at https://<ACCOUNT_ID>.artifacts.cloudflare.net/git/<namespace>/<repo>.git.

Replace the <ACCOUNT_ID> placeholder with your Cloudflare account ID. Use the exact hostname from the repo remote returned by the Workers binding or REST API.

Use the returned repo remote with a regular Git client for clone, fetch, pull, and push.

Authentication

Git routes accept repo access tokens in two forms:

FormatDetailsExample
Bearer token in http.extraHeaderRecommended for local workflows. Use the full token string returned by the control plane and keep credentials out of the remote URL.git -c http.extraHeader="Authorization: Bearer $ARTIFACTS_TOKEN" clone "$ARTIFACTS_REMOTE" artifacts-clone
HTTP Basic auth in the remote URLUse for short-lived, one-off commands when you need a self-contained remote. Put the token secret in the password slot.https://x:<token-secret>@<ACCOUNT_ID>.artifacts.cloudflare.net/git/<namespace>/<repo>.git

Token format

Repo tokens are issued in the format art_v1_<40 hex>?expires=<unix_seconds>. The ?expires= suffix is the token's expiry as a unix timestamp in seconds. To check when a token expires, parse the value after ?expires=.

Git extraHeader parameter

Git's http.extraHeader setting lets you attach an HTTP header to git requests.

If you want to use the full token string returned by the API, pass it as a Bearer token:

Terminal window
git -c http.extraHeader="Authorization: Bearer $ARTIFACTS_TOKEN" clone "$ARTIFACTS_REMOTE" artifacts-clone

HTTPS remote with Basic auth

For the URL form, use the token secret in the password slot. Artifacts ignores the Basic auth username.

Use this form only when you need a self-contained remote URL for a short-lived command.

Terminal window
export ARTIFACTS_TOKEN_SECRET="${ARTIFACTS_TOKEN%%\?expires=*}"
export ARTIFACTS_AUTH_REMOTE="https://x:${ARTIFACTS_TOKEN_SECRET}@${ARTIFACTS_REMOTE#https://}"
Terminal window
git clone "$ARTIFACTS_AUTH_REMOTE" artifacts-clone
Terminal window
git push "$ARTIFACTS_AUTH_REMOTE" HEAD:main

Use any non-empty username in the URL. Artifacts accepts that username but does not otherwise use or log it, so x is just a placeholder.

Protocol support

Artifacts supports Git protocol v1 and v2 for clone and fetch. Git clients negotiate the protocol automatically.

OperationGit serviceProtocol supportNotes
Clone and fetchgit-upload-packv1 and v2Protocol v2 supports ls-refs and fetch. Protocol v1 supports normal fetch flows, including shallow and deepen fetches.
Pushgit-receive-packv1Push uses the standard v1 receive-pack flow.
Push over protocol v2git-receive-packNot supportedArtifacts does not support v2 receive-pack.
Optional protocol v1 capabilitiesgit-upload-packPartialSome optional v1 capabilities, such as filter and include-tag, are not supported.

Token scopes

ScopeCommandsNotes
readgit clone, git fetch, git pullUse for read-only access.
writegit clone, git fetch, git pull, git pushgit push mutates the repo and requires a write token.