# salt.states.git

## Interaction with Git repositories.

Important: Before using git over ssh, make sure your remote host fingerprint exists in "~/.ssh/known_hosts" file. To avoid requiring password authentication, it is also possible to pass private keys to use explicitly.

    https://github.com/saltstack/salt.git:
      git.latest:
        - rev: develop
        - target: /tmp/salt

`salt.states.git.` `latest`(name, rev=None, target=None, runas=None, user=None, force=None, force_checkout=False, submodules=False, mirror=False, bare=False, remote_name='origin', always_fetch=False, identity=None, onlyif=False, unless=False)

  Make sure the repository is cloned to the given directory and is up to date

  name
    Address of the remote repository as passed to "git clone"
  rev
    The remote branch, tag, or revision ID to checkout after clone / before update
  target
    Name of the target directory where repository is about to be cloned
  runas

    Name of the user performing repository management operations

    Deprecated since version 0.17.0.

  user

    Name of the user performing repository management operations

    New in version 0.17.0.

  force
    Force git to clone into pre-existing directories (deletes contents)
  force_checkout
    Force a checkout even if there might be overwritten changes (Default: False)
  submodules
    Update submodules on clone or branch change (Default: False)
  mirror
    True if the repository is to be a mirror of the remote repository. This implies bare, and thus is incompatible with rev.
  bare
    True if the repository is to be a bare clone of the remote repository. This is incompatible with rev, as nothing will be checked out.
  remote_name
    defines a different remote name. For the first clone the given name is set to the default remote, else it is just a additional remote. (Default: 'origin')
  always_fetch
    If a tag or branch name is used as the rev a fetch will not occur until the tag or branch name changes. Setting this to true will force a fetch to occur. Only applies when rev is set. (Default: False)
  identity
    A path to a private key to use over SSH
  onlyif
    A command to run as a check, run the named command only if the command passed to the `onlyif` option returns true
  unless
    A command to run as a check, only run the named command if the command passed to the `unless` option returns false

`salt.states.git.` `present`(name, bare=True, runas=None, user=None, force=False)

  Make sure the repository is present in the given directory

  name
    Name of the directory where the repository is about to be created
  bare
    Create a bare repository (Default: True)
  runas

    Name of the user performing repository management operations

    Deprecated since version 0.17.0.

  user

    Name of the user performing repository management operations

    New in version 0.17.0.

  force
    Force-create a new repository into an pre-existing non-git directory (deletes contents)

Current Salt release: 0.17.1

### Table Of Contents

- salt.states.git
  - Interaction with Git repositories.

#### Previous topic

salt.states.gem

#### Next topic

salt.states.grains

### Quick search

Enter search terms or a module, class or function name.

### Upcoming SaltStack Events

My conferences on Lanyrd