Clones a GitHub repository at create time, using gh when authenticated and Git for public HTTPS o...
5.6K
Clones a GitHub repository at create time, using gh when authenticated and Git for public HTTPS or SSH transport.
| Name | Required | Default | Description |
|---|---|---|---|
dir | Optional | /project | Absolute directory inside the sandbox to clone into. If the directory already exists and is non-empty, the clone is skipped (the mixin re-runs cleanly on `sbx create` retries). |
ref | Optional | | Optional git ref (branch, tag, or 7–40 hex commit SHA) to check out. Empty (the default) clones the repo's default branch. |
repo | Required | — | GitHub repository to clone. Accepts the `owner/name` shorthand, a full `https://github.com/owner/name[.git]` URL, or an `[email protected]:owner/name[.git]` SSH URL. Any other form is rejected before the clone shells out. |
version | Required | — | Kit revision supplied by the DHI build |
| Type | Required | Description | |
|---|---|---|---|
com.docker.sandbox/ssh-agent@1 | Optional | — | |
com.docker.sandbox/network-policy@1 | Required | — | |
com.docker.sandbox/lifecycle@1 | Required | — | |
com.docker.sandbox/agent-context@1 | Optional | — | |
com.docker.sandbox/agent-context@2 | Optional | — | |
sbx run <agent> --kit sbx/github-clone:latestRun the following command to install sbx on your machine.
brew install docker/tap/sbxwinget install Docker.sbxThis v3 mixin Kit clones a GitHub repository at sandbox creation into a chosen directory (/project by default). It
preserves a non-empty destination on retries and installs gh and git through apt only when the workload lacks them.
Node is not required. This Kit is built on Docker Hardened Images.
Public HTTPS repositories need no credential binding:
sbx run sbx/claude --kit sbx/github-clone --kit-arg repo=docker/sbx-kits-contrib
A branch or tag can be selected, with a separate destination:
sbx run sbx/claude --kit sbx/github-clone --kit-arg repo=docker/sbx-kits-contrib --kit-arg ref=v0.2.0 --kit-arg dir=/workspace/src
| Argument | Required | Default | Meaning |
|---|---|---|---|
repo | yes | owner/name, https://github.com/owner/name[.git], or [email protected]:owner/name[.git] | |
ref | no | default branch | Branch, tag or commit SHA |
dir | no | /project | Absolute destination path; a non-empty directory is left untouched |
Arguments are checked before they reach the hook. Branches and tags use a shallow clone; commit SHAs fall back to a full clone and detached checkout.
The mixin declares no GitHub token credential. It consumes GH_TOKEN from another kit's binding, when available during
install. Bind a GitHub token on the host as described in the
Docker Sandboxes documentation. A provider granting only runtime credentials
cannot authenticate this install-time clone. Private HTTPS repositories require an install-phase provider; runtime
access needs its own runtime binding.
With an authenticated gh configuration or GH_TOKEN, HTTPS cloning uses gh repo clone. Without one it uses Git
directly, so public repositories remain usable. The system Git credential helper points at gh auth git-credential for
later HTTPS operations, including when a non-empty destination skips cloning. Dynamic credentials stay runtime-owned and
are never included in image layers.
Use the [email protected]:owner/name.git form with github-ssh. Its host-key
hook runs first through the optional integrates: [github-ssh] dependency. HTTPS clones do not require that companion.
This kit requests an optional install-phase SSH agent restricted to [email protected], with no signing grant. SSH cloning
needs that grant and an OpenSSH client supplied by the workload; github-ssh states the deb/openssh-client and
deb/jq requirements. Its separate runtime agent binding serves later SSH pushes and pulls. A runtime-only agent cannot
serve the install hook. SSH transport does not consume GH_TOKEN.
Two root install hooks ensure tools, then clone and hand the destination to uid 1000. Missing tools are installed on Debian/Ubuntu workloads with apt; other workloads receive an actionable error. The hook explicitly receives proxy variables and the install agent socket when granted.
GitHub hosts are reachable during install and runtime for cloning and later Git operations. Apt hosts (cli.github.com,
Debian/DHI, Ubuntu and Docker repositories) are install-only because apt refreshes configured sources. Runtime policy
closes that install access before agent launch. The native DHI Claude and shell workloads already provide the needed
programs, so this path does not require package installation there.
This Kit follows the v3 Kit specification. See the public Docker Hub page for its published artifact.