git-repo-synced

Example:

# Clone the 'freckles' git repo into $HOME.
- git-repo-synced:
    repo: https://gitlab.com/freckles-io/freckles.git
    dest: ~/freckles

Description

Clones or pulls a git repository.

Create the group/owner if not available on the system. This does not put the owner into the group if both are specified, so do that before-hand if you need that much control.

This does not install 'git' if it isn't already available and will fail if that's the case.

Variables

Name Type Default Description

dest

string --

The destination path. Required

repo

string --

The source repository. Required

group

string --

The group of the target folder.

owner

string --

The owner of the target folder.

version

string master

The version (tag, branch, hash, ..) to use.

Examples

Example 1

Clone the 'freckles' git repo into $HOME.

Code
- git-repo-synced:
    repo: https://gitlab.com/freckles-io/freckles.git
    dest: ~/freckles

Example 2

Clone the 'freckles' git repo, create users if not exist already.

Code
- git-repo-synced:
    repo: https://gitlab.com/freckles-io/freckles.git
    dest: /var/lib/parent/freckles
    owner: freckles
    group: freckles
Description

This creates the group/user 'freckles' as well as the parent directory /var/lib/parent (if necessary), then checks out the 'freckles' git repo into it, and changes the owner and group to be 'freckles'.

Command-line

frecklecute git-repo-synced --help

Usage: frecklecute git-repo-synced [OPTIONS]

  Clones or pulls a git repository.

  Create the group/owner if not available on the system. This does not put
  the owner into the group if both are specified, so do that before-hand if
  you need that much control.

  This does not install 'git' if it isn't already available and will fail if
  that's the case.

Options:
  --dest PATH        The destination path.  [required]
  --repo URL         The source repository.  [required]
  --group GROUP      The group of the target folder.
  --owner OWNER      The owner of the target folder.
  --version VERSION  The version (tag, branch, hash, ..) to use.  [default:
                     master]
  --help             Show this message and exit.