Clone
Clone a Git repository.
type: "io.kestra.plugin.git.Clone"
Examples
Clone a public GitHub repository.
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.
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.
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.
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).
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
url *Requiredstring
The URI to clone from
branch string
The branch to checkout -- ignored if "commit" is provided.
cloneSubmodules booleanstring
Whether to clone submodules
commit string
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.
depth integerstring
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.
directory string
The optional directory associated with the clone operation
If the directory isn't set, the current directory will be used.
gitConfig object
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
passphrase string
The passphrase for the privateKey
password string
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 string
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.
trustedCaPemPath string
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.
username string
The username or organization
Outputs
directory string
The path where the repository is cloned