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.
config
(name, value, repo=None, user=None, is_global=False)¶New in version 2014.7.0.
Manage a git config setting for a user or repository
Local config example:
mylocalrepo:
git.config:
- name: user.email
- value: [email protected]
- repo: file://my/path/to/repo
Global config example:
mylocalrepo:
git.config:
- name: user.name
- value: Esther Bestertester
- user: ebestertester
- is_global: True
salt.states.git.
latest
(name, rev=None, target=None, runas=None, user=None, force=None, force_checkout=False, force_reset=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 of the user performing repository management operations
Deprecated since version 0.17.0.
Name of the user performing repository management operations
New in version 0.17.0.
onlyif
option returns trueunless
option returns falseNote
Clashing ID declarations can be avoided when including different
branches from the same git repository in the same sls file by using the
name
declaration. The example below checks out the gh-pages
and gh-pages-prod
branches from the same repository into separate
directories. The example also sets up the ssh_known_hosts
ssh key
required to perform the git checkout.
gitlab.example.com:
ssh_known_hosts:
- present
- user: root
- enc: ecdsa
- fingerprint: 4e:94:b0:54:c1:5b:29:a2:70:0e:e1:a3:51:ee:ee:e3
git-website-staging:
git.latest:
- name: [email protected]:user/website.git
- rev: gh-pages
- target: /usr/share/nginx/staging
- identity: /root/.ssh/website_id_rsa
- require:
- pkg: git
- ssh_known_hosts: gitlab.example.com
git-website-prod:
git.latest:
- name: [email protected]:user/website.git
- rev: gh-pages-prod
- target: /usr/share/nginx/prod
- identity: /root/.ssh/website_id_rsa
- require:
- pkg: git
- ssh_known_hosts: gitlab.example.com
salt.states.git.
mod_run_check
(cmd_kwargs, onlyif, unless)¶Execute the onlyif and unless logic. Return a result dict if: * onlyif failed (onlyif != 0) * unless succeeded (unless == 0) else return True
salt.states.git.
present
(name, bare=True, runas=None, user=None, force=False)¶Make sure the repository is present in the given directory
Name of the user performing repository management operations
Deprecated since version 0.17.0.
Name of the user performing repository management operations
New in version 0.17.0.