]> git.ipfire.org Git - thirdparty/git.git/blob - Documentation/config/safe.txt
clone: allow "--bare" with "-o"
[thirdparty/git.git] / Documentation / config / safe.txt
1 safe.directory::
2 These config entries specify Git-tracked directories that are
3 considered safe even if they are owned by someone other than the
4 current user. By default, Git will refuse to even parse a Git
5 config of a repository owned by someone else, let alone run its
6 hooks, and this config setting allows users to specify exceptions,
7 e.g. for intentionally shared repositories (see the `--shared`
8 option in linkgit:git-init[1]).
9 +
10 This is a multi-valued setting, i.e. you can add more than one directory
11 via `git config --add`. To reset the list of safe directories (e.g. to
12 override any such directories specified in the system config), add a
13 `safe.directory` entry with an empty value.
14 +
15 This config setting is only respected when specified in a system or global
16 config, not when it is specified in a repository config, via the command
17 line option `-c safe.directory=<path>`, or in environment variables.
18 +
19 The value of this setting is interpolated, i.e. `~/<path>` expands to a
20 path relative to the home directory and `%(prefix)/<path>` expands to a
21 path relative to Git's (runtime) prefix.
22 +
23 To completely opt-out of this security check, set `safe.directory` to the
24 string `*`. This will allow all repositories to be treated as if their
25 directory was listed in the `safe.directory` list. If `safe.directory=*`
26 is set in system config and you want to re-enable this protection, then
27 initialize your list with an empty value before listing the repositories
28 that you deem safe.
29 +
30 As explained, Git only allows you to access repositories owned by
31 yourself, i.e. the user who is running Git, by default. When Git
32 is running as 'root' in a non Windows platform that provides sudo,
33 however, git checks the SUDO_UID environment variable that sudo creates
34 and will allow access to the uid recorded as its value in addition to
35 the id from 'root'.
36 This is to make it easy to perform a common sequence during installation
37 "make && sudo make install". A git process running under 'sudo' runs as
38 'root' but the 'sudo' command exports the environment variable to record
39 which id the original user has.
40 If that is not what you would prefer and want git to only trust
41 repositories that are owned by root instead, then you can remove
42 the `SUDO_UID` variable from root's environment before invoking git.