# Git clone

> **About this page**
>
> - Task definition version: `swaleio/git-clone@2.54.1`
> - Summary: Clones a Git repository into the workspace over HTTPS, with optional token auth and Git LFS support.
> - Published: 2026-11-25, not the latest version
> - Page: https://hub.swale.io/swaleio/git-clone/v/2.54.1
> - Latest version's copy: https://hub.swale.io/swaleio/git-clone.md
> - Versions: https://hub.swale.io/swaleio/git-clone/versions
> - Index of Swale Hub: https://hub.swale.io/llms.txt
>
> The YAML block below is the task definition's frontmatter, which declares its inputs, outputs and container, and its readme follows. Both are the text of the account that published this task definition, not Swale's.

```yaml
name: Git clone
description: Clones a Git repository into the workspace over HTTPS, with optional token auth and Git LFS support.
category: data-transfer
inputs:
  repository_url:
    description: HTTPS URL of the repository to clone.
    required: true
  revision:
    description: Branch, tag, or commit to check out. Defaults to the repository's default branch.
    default: ""
  dest:
    description: Absolute path inside the container. Point it at the mounted workspace (e.g. ${{env.WORKFLOW_STORAGE}}/repo) to share the result with later tasks, or any other container-local path.
    required: true
  git_token:
    description: Token for private-repository HTTPS auth (pass a secret). Omit for public repos.
    default: ""
outputs:
  commit_sha:
    description: The resolved HEAD commit SHA after cloning.
exec:
  # docker.io/swaleio/git:2.54.1
  image: docker.io/swaleio/git@sha256:6c52d685c078aeccc89716f4250900935330920a802972926a5bbd6ae2baa729
  args:
    - clone
    - "--depth=1"
    - ${{inputs.repository_url}}
    - ${{inputs.dest}}
```

# Git clone

Clones `repository_url` into the container-local path given by `dest` and emits
the resolved `commit_sha` for downstream tasks.

## Inputs

| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `repository_url` | yes | — | HTTPS URL of the repository. |
| `revision` | no | default branch | Branch, tag, or commit to check out. |
| `dest` | yes | — | Absolute clone path inside the container. Point it at the mounted workspace (e.g. `${{env.WORKFLOW_STORAGE}}/repo`) to share the clone with later tasks, or any other container-local path. |
| `git_token` | no | — | Token for private repos (pass a project/account secret). |

## Outputs

| Output | Description |
|--------|-------------|
| `commit_sha` | The resolved HEAD commit SHA. |

## Compute

**CPU.** Data movement only — no GPU is needed, and scheduling it on a GPU compute type wastes money.

## Example

```yaml
name: Git clone example
compute_type: cpu-4
entry_point: main

blocks:
  main:
    tasks:
      checkout:
        name: Checkout
        uses: swaleio/git-clone
        args:
          repository_url: https://github.com/acme/app.git
          dest: ${{env.WORKFLOW_STORAGE}}/repo
          git_token: ${{secrets.github_token}}
```

Downstream tasks read the cloned files at `${{env.WORKFLOW_STORAGE}}/repo` and the commit
via `${{tasks.checkout.outputs.commit_sha}}`.

---

For the workflow syntax these examples use, see the
[workflow definition reference](https://docs.swale.io/reference/workflow-definition-syntax)
in the [Swale documentation](https://docs.swale.io).

Licensed under the [MIT License](https://github.com/swaleio/task-definitions/blob/main/LICENSE).
