1GITNAMESPACES(7)                  Git Manual                  GITNAMESPACES(7)
2
3
4

NAME

6       gitnamespaces - Git namespaces
7

SYNOPSIS

9       GIT_NAMESPACE=<namespace> git upload-pack
10       GIT_NAMESPACE=<namespace> git receive-pack
11
12

DESCRIPTION

14       Git supports dividing the refs of a single repository into multiple
15       namespaces, each of which has its own branches, tags, and HEAD. Git can
16       expose each namespace as an independent repository to pull from and
17       push to, while sharing the object store, and exposing all the refs to
18       operations such as git-gc(1).
19
20       Storing multiple repositories as namespaces of a single repository
21       avoids storing duplicate copies of the same objects, such as when
22       storing multiple branches of the same source. The alternates mechanism
23       provides similar support for avoiding duplicates, but alternates do not
24       prevent duplication between new objects added to the repositories
25       without ongoing maintenance, while namespaces do.
26
27       To specify a namespace, set the GIT_NAMESPACE environment variable to
28       the namespace. For each ref namespace, Git stores the corresponding
29       refs in a directory under refs/namespaces/. For example,
30       GIT_NAMESPACE=foo will store refs under refs/namespaces/foo/. You can
31       also specify namespaces via the --namespace option to git(1).
32
33       Note that namespaces which include a / will expand to a hierarchy of
34       namespaces; for example, GIT_NAMESPACE=foo/bar will store refs under
35       refs/namespaces/foo/refs/namespaces/bar/. This makes paths in
36       GIT_NAMESPACE behave hierarchically, so that cloning with
37       GIT_NAMESPACE=foo/bar produces the same result as cloning with
38       GIT_NAMESPACE=foo and cloning from that repo with GIT_NAMESPACE=bar. It
39       also avoids ambiguity with strange namespace paths such as
40       foo/refs/heads/, which could otherwise generate directory/file
41       conflicts within the refs directory.
42
43       git-upload-pack(1) and git-receive-pack(1) rewrite the names of refs as
44       specified by GIT_NAMESPACE. git-upload-pack and git-receive-pack will
45       ignore all references outside the specified namespace.
46
47       The smart HTTP server, git-http-backend(1), will pass GIT_NAMESPACE
48       through to the backend programs; see git-http-backend(1) for sample
49       configuration to expose repository namespaces as repositories.
50
51       For a simple local test, you can use git-remote-ext(1):
52
53           git clone ext::'git --namespace=foo %s /tmp/prefixed.git'
54
55

SECURITY

57       The fetch and push protocols are not designed to prevent one side from
58       stealing data from the other repository that was not intended to be
59       shared. If you have private data that you need to protect from a
60       malicious peer, your best option is to store it in another repository.
61       This applies to both clients and servers. In particular, namespaces on
62       a server are not effective for read access control; you should only
63       grant read access to a namespace to clients that you would trust with
64       read access to the entire repository.
65
66       The known attack vectors are as follows:
67
68        1. The victim sends "have" lines advertising the IDs of objects it has
69           that are not explicitly intended to be shared but can be used to
70           optimize the transfer if the peer also has them. The attacker
71           chooses an object ID X to steal and sends a ref to X, but isn’t
72           required to send the content of X because the victim already has
73           it. Now the victim believes that the attacker has X, and it sends
74           the content of X back to the attacker later. (This attack is most
75           straightforward for a client to perform on a server, by creating a
76           ref to X in the namespace the client has access to and then
77           fetching it. The most likely way for a server to perform it on a
78           client is to "merge" X into a public branch and hope that the user
79           does additional work on this branch and pushes it back to the
80           server without noticing the merge.)
81
82        2. As in #1, the attacker chooses an object ID X to steal. The victim
83           sends an object Y that the attacker already has, and the attacker
84           falsely claims to have X and not Y, so the victim sends Y as a
85           delta against X. The delta reveals regions of X that are similar to
86           Y to the attacker.
87
88
89
90Git 2.24.1                        12/10/2019                  GITNAMESPACES(7)
Impressum