Git Clone

Git Clone

Certified

Clone a Git repository

Clones a repository over HTTP(S) or SSH, optionally checking out a branch, tag, or commit. Defaults to a shallow clone (depth 1) unless a tag or commit is requested; set cloneSubmodules to fetch submodules.

yaml
type: io.kestra.plugin.git.Clone

Clone a public GitHub repository.

yaml
id: git_clone
namespace: company.team

tasks:
  - id: wdir
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: clone
        type: io.kestra.plugin.git.Clone
        url: https://github.com/kestra-io/blueprints
        branch: main

Clone a private repository from an HTTP server such as a private GitHub repository using a personal access token.

yaml
id: git_clone
namespace: company.team

tasks:
  - id: wdir
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: clone
        type: io.kestra.plugin.git.Clone
        url: https://github.com/kestra-io/blueprints
        branch: main
        username: git_username
        password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"

Clone a repository from an SSH server. If you want to clone the repository into a specific directory, you can configure the directory property as shown below.

yaml
id: git_clone
namespace: company.team

tasks:
  - id: wdir
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: clone
        type: io.kestra.plugin.git.Clone
        url: git@github.com:kestra-io/kestra.git
        directory: kestra
        privateKey: "{{ secret('SSH_PRIVATE_KEY') }}"
        passphrase: "{{ secret('SSH_PASSPHRASE') }}"

Clone a GitHub repository and run a Python ETL script. Note that the WorkingDirectory task is required so that the Python script shares the same local file system with files cloned from GitHub in the previous task.

yaml
id: git_python
namespace: company.team

tasks:
  - id: file_system
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: clone_repository
        type: io.kestra.plugin.git.Clone
        url: https://github.com/kestra-io/examples
        branch: main
      - id: python_etl
        type: io.kestra.plugin.scripts.python.Commands
        dependencies:
          - requests
          - pandas
        commands:
          - python examples/scripts/etl_script.py

Clone then checkout a specific commit (detached HEAD).

yaml
id: git_clone_commit
namespace: company.team

tasks:
  - id: clone_at_sha
    type: io.kestra.plugin.git.Clone
    url: https://github.com/kestra-io/kestra
    commit: 98189392a2a4ea0b1a951cd9dbbfe72f0193d77b
Properties

Repository URL

HTTP(S) or SSH URI used for clone and push operations.

Branch to checkout

Used only when no commit or tag is specified.

Defaulttrue

Clone all branches

When true, clones all remote branches. When false, follows single-branch clone behavior.

Clone submodules

Default false; enable to fetch and initialize nested submodules.

Commit SHA to checkout

Detached HEAD checkout; short SHA allowed. Overrides branch and disables shallow clone.

Default10000

HTTP connect timeout (ms)

Default 10000 ms.

Default1

Shallow clone depth

Defaults to 1. Ignored when commit or tag is set to ensure history is available.

Target directory

Subdirectory under the working directory where the repo is cloned; defaults to the working directory root.

Git configuration overrides

Map of git config keys and values applied after clone, e.g.:

  • core.fileMode: false (ignore permission flips)
  • core.autocrlf: false (preserve line endings)

Disable proxy for HTTP

When true, forces direct connections instead of using the JVM proxy settings.

Defaultfalse

Do not fetch tags

When true, skip fetching tags during clone and fetch fallback.

Passphrase for privateKey

Password or personal access token

Supplies HTTP credentials. When a PAT is used, pushes are recorded under that PAT’s user without needing authorName and authorEmail.

**GitHub PAT permissions required: **

  • Fine-grained PAT: Contents: Read (clone/fetch) or Contents: Read and Write (push), plus Metadata: Read (mandatory base permission). Add Workflows: Read and Write when pushing .github/workflows/ files.
  • Classic PAT: repo scope covers all read/write operations; add workflow when pushing workflow files.

Reference (ref) of the pluginDefaults to apply to this task.

PEM private key

PEM-formatted private key matching a public key registered on the Git server. Generate with ssh-keygen -t ecdsa -b 256 -m PEM.

Default60000

HTTP read timeout (ms)

Default 60000 ms.

Tag to checkout

Ignored when commit is set; performs a full fetch to reach the tag.

Extra trusted CA PEM path

Optional PEM-encoded CA bundle added to the JVM truststore; equivalent to git config http.sslCAInfo <path> for self-signed or internal CAs.

Username or organization

Used for HTTP basic authentication and as a fallback commit author.

Path where the repository is cloned