Clone Clone

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

Clone a repository.

Examples

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: your_personal_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

Properties

url

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The URI to clone from.

branch

  • Type: string
  • Dynamic: ✔️
  • Required:

The initial Git branch.

cloneSubmodules

  • Type: boolean
  • Dynamic:
  • Required:

Whether to clone submodules.

depth

  • Type: integer
  • Dynamic:
  • Required:
  • Default: 1
  • Minimum: >= 1

Creates a shallow clone with a history truncated to the specified number of commits.

directory

  • Type: string
  • Dynamic: ✔️
  • Required:

The optional directory associated with the clone operation.

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

passphrase

  • Type: string
  • Dynamic: ✔️
  • Required:

The passphrase for the privateKey.

password

  • Type: string
  • Dynamic: ✔️
  • Required:

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).

privateKey

  • Type: string
  • Dynamic: ✔️
  • Required:

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.

username

  • Type: string
  • Dynamic: ✔️
  • Required:

The username or organization.

Outputs

directory

  • Type: string
  • Required:

The path where the repository is cloned.

Definitions

Was this page helpful?