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: fester@bestertester.net
- 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, user=None, force=None, force_checkout=False, force_reset=False, submodules=False, mirror=False, bare=False, remote_name='origin', always_fetch=False, fetch_tags=True, depth=None, identity=None, https_user=None, https_pass=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
New in version 0.17.0.
--reset hard
to the remote ref
(Default: False)depth: 1
is usefull when deploying from a repository
with a long history. Use rev to specify branch. This is not compatible with tags or revision IDs.(Default: None
)HTTP Basic Auth username for HTTPS (only) clones
New in version 2015.5.0.
HTTP Basic Auth password for HTTPS (only) clones
New in version 2015.5.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: git@gitlab.example.com: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: git@gitlab.example.com: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, user=None, force=False, shared=None)¶Make sure the repository is present in the given directory
Name of the user performing repository management operations
New in version 0.17.0.
Specify the permission for sharing, see git-init for details (Default: None)
New in version XXXX.