Git Fileserver Backend

With this backend, branches and tags in a remote git repository are exposed to salt as different environments.

To enable, add git to the fileserver_backend option in the Master config file.

  - git

As of Salt 2014.7.0, the Git fileserver backend supports GitPython, pygit2, and dulwich to provide the Python interface to git. If more than one of these are present, the order of preference for which one will be chosen is the same as the order in which they were listed: pygit2, GitPython, dulwich (keep in mind, this order is subject to change).

An optional master config parameter (gitfs_provider) can be used to specify which provider should be used.

More detailed information on how to use gitfs can be found in the Gitfs Walkthrough.


Minimum requirements

To use GitPython for gitfs requires a minimum GitPython version of 0.3.0, as well as the git CLI utility. Instructions for installing GitPython can be found here.

To use pygit2 for gitfs requires a minimum pygit2 version of 0.20.3. pygit2 0.20.3 requires libgit2 0.20.0. pygit2 and libgit2 are developed alongside one another, so it is recommended to keep them both at the same major release to avoid unexpected behavior. For example, pygit2 0.21.x requires libgit2 0.21.x, pygit2 0.22.x will require libgit2 0.22.x, etc.

To find stale refs, pygit2 additionally requires the git CLI utility to be installed.


Completely clear gitfs cache






Return a list of refs that can be used as environments

salt.fileserver.gitfs.file_hash(load, fnd)



Return a list of all files on the file server in a specified environment (specified as a key within the load dict).


Return a list of all empty directories on the master

salt.fileserver.gitfs.find_file(path, tgt_env='base', **kwargs)

Find the first file to match the path and ref, read the file out of git and send the path to the newly cached file


Initialize remotes. This is only used by the master's pre-flight checks, and is not invoked by GitFS.


Place an

remote can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked.

salt.fileserver.gitfs.serve_file(load, fnd)


Return a dict of all symlinks based on a given path in the repo


Execute a git fetch on all of the repos