Skip to main content

git

git module

Clone or update Git repositories. This module can clone repositories from remote sources and checkout specific versions, branches, or tags.

Examples

- name: Clone a repository
git:
repo: https://github.com/user/repo.git
dest: /opt/myapp

- name: Clone specific branch
git:
repo: https://github.com/user/repo.git
dest: /opt/myapp
version: develop

- name: Clone specific tag
git:
repo: https://github.com/user/repo.git
dest: /opt/myapp
version: v1.0.0

- name: Clone with SSH
git:
repo: [email protected]:user/repo.git
dest: /opt/myapp

Note: This module requires git to be installed on the target host. SSH keys must be configured for SSH repositories.

Module Capabilities

  • Has Revert: true
  • Provides Variables: None

Inputs

ParameterTypeDescriptionRequiredDefaultChoices
deststringPath where the repository should be cloned or updated.false
repostringURL of the git repository to clone. Supports HTTP(S) and SSH protocols.false
versionstringVersion to checkout. Can be a branch name, tag, or commit hash.falseHEAD

Outputs

No outputs.