Git over HTTPS
Amendable speaks Git Smart HTTP. If git clone works against GitHub over HTTPS, it works here. There is no SSH remote.
Remote URL
Section titled “Remote URL”https://amendable.io/r/<username>/<repo>.gitInfo refs:
GET https://amendable.io/r/<username>/<repo>.git/info/refs?service=git-upload-packGET https://amendable.io/r/<username>/<repo>.git/info/refs?service=git-receive-packYou rarely call those yourself. git does.
Credentials
Section titled “Credentials”Git uses HTTP Basic. The password is the access token. See Authentication.
git clone "https://USER:${AMENDABLE_TOKEN}@amendable.io/r/USER/REPO.git"Works, but the token lands in .git/config. After the clone:
git remote set-url origin "https://amendable.io/r/USER/REPO.git"printf '%s\n' '#!/bin/sh' 'echo "$AMENDABLE_TOKEN"' > /tmp/askpasschmod 700 /tmp/askpassGIT_ASKPASS=/tmp/askpass git clone https://amendable.io/r/USER/REPO.gitGit still sends a username. Any non-empty username is fine when the password is a valid token.
amendable logingit config --global credential.https://amendable.io.helper '!amendable git-credential'git clone https://amendable.io/r/USER/REPO.gitThe helper prints username and password (the token) on get. It ignores store and erase.
amendable repo clone REPO does the clone and sets the helper on that repo only.
Required grants (Grants):
- Clone and fetch:
GIT_HTTP_READ - Push:
GIT_HTTP_WRITE(read is added automatically)
First push
Section titled “First push”Empty repositories accept whichever branch you push first. Until the first push, GET /v1/repos/{user}/{repo}/branches is 200 with {"branches":[],"default_branch":"master"}. GET /v1/repos/{user}/{repo}/commits on the same empty repo is 404 No commit found in the repository. That 404 is for commits, not branches.
git switch -c maingit add .git commit -m "Initial commit"git push -u origin mainThe first commit may also have an empty tree (no files). That matches GitHub and GitLab. Agent bootstraps often start this way with git commit --allow-empty:
git switch -c maingit commit --allow-empty -m "Initialize repository"git push -u origin mainAfter the first push, GET /v1/repos/{user}/{repo}/branches lists each branch tip and default_branch is the branch you pushed. That endpoint needs API_COMMITS_READ or ALL.
A later force-push is a normal Git push. Clones see the new tip. The previous push is still an immutable layer, so rewritten Git history does not erase earlier changes. See Auditable history.
libgit2 / pygit2
Section titled “libgit2 / pygit2”import osfrom urllib.parse import quote
import pygit2
user = os.environ["AMENDABLE_USERNAME"]token = os.environ["AMENDABLE_TOKEN"]repo = os.environ["AMENDABLE_REPO"]url = f"https://{quote(user)}:{quote(token)}@amendable.io/r/{user}/{repo}.git"callbacks = pygit2.RemoteCallbacks()pygit2.clone_repository(url, "/tmp/amendable-clone", callbacks=callbacks)Any HTTPS Git library works. There is no custom Git protocol.
To list a directory or download a file over the REST API without cloning, see Fetch files.
Transfer metering
Section titled “Transfer metering”Clone and fetch count as transfer (egress). So do contents API response bodies. Push bodies count as ingress (metered, not billed). Free accounts include 5 GiB transfer per UTC month. Hitting the free cap returns an error on Git HTTP and on contents downloads. Paid plans have included transfer plus overage.