Clone a Git repository.

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

Clone a public GitHub repository.

yaml
id: git_clone
namespace: company.team

tasks:
  - id: clone
    type: io.kestra.plugin.git.Clone
    url: https://github.com/dbt-labs/jaffle_shop
    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: clone
    type: io.kestra.plugin.git.Clone
    url: https://github.com/kestra-io/examples
    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: clone
    type: io.kestra.plugin.git.Clone
    url: git@github.com:kestra-io/kestra.git
    directory: kestra
    privateKey: <keyfile_content>
    passphrase: <passphrase>

Clone a GitHub repository and run a Python ETL script. Note that the Worker 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
        beforeCommands:
          - pip install requests pandas > /dev/null
        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

The URI to clone from

The branch to checkout -- ignored if "commit" is provided.

Whether to clone submodules

Commit SHA1 to checkout (detached HEAD) -- works also with a shortened SHA1.

If set, the repository is cloned and the specified commit is checked out. This takes precedence over branch and disables shallow cloning to ensure the commit is present.

Default 1

Creates a shallow clone with a history truncated to the specified number of commits. Ignored when commit is provided to guarantee the commit is available.

The optional directory associated with the clone operation

If the directory isn't set, the current directory will be used.

Git configuration to apply to the repository

Map of Git config keys and values, applied after clone few examples: - 'core.fileMode': false -> ignore file permission changes - 'core.autocrlf': false -> prevent line ending conversion

The passphrase for the privateKey

The password or Personal Access Token (PAT) -- when you authenticate the task with a PAT, any flows or files pushed to Git from Kestra will be pushed from the user associated with that PAT. This way, you don't need to configure the commit author (the authorName and authorEmail properties).

PEM-format private key content that is paired with a public key registered on Git

To generate an ECDSA PEM format key from OpenSSH, use the following command: ssh-keygen -t ecdsa -b 256 -m PEM. You can then set this property with your private key content and put your public key on Git.

Optional path to a PEM-encoded CA certificate to trust (in addition to the JVM default truststore)

Equivalent to git config http.sslCAInfo <path>. Use this for self-signed/internal CAs.

The username or organization

The path where the repository is cloned