Skip to content

git.clone

Idempotently clone or update a git repository at a specific ref

Properties

Property Type Required Description
credentials object No -
depth integer No -
dest string Yes -
force boolean No -
recurse_submodules boolean No -
ref string No -
repo string Yes -
update boolean No -
url string No -

Examples

# Clone or update to a tagged version (idempotent)
- name: Vendor the upstream repo
  git.clone:
    repo: https://github.com/anthropics/anthropic-sdk-go.git
    dest: "{{ home }}/src/anthropic-sdk-go"
    ref: v1.2.3
# Track a branch tip (re-runs fast-forward when remote moves)
- git.clone:
    repo: [email protected]:internal/infra.git
    dest: /opt/infra
    ref: main

Platform Support

linux, darwin, windows, freebsd