Updated git_doc to git 1.8
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / gitnamespaces.xml
blobeb3a06a061547bc1fecd8e135396643ec67ea581
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="gitnamespaces(7)">\r
5     <title>gitnamespaces(7)</title>\r
6 <indexterm>\r
7 <primary>gitnamespaces(7)</primary>\r
8 </indexterm>\r
9 <simplesect id="gitnamespaces(7)__name">\r
10 <title>NAME</title>\r
11 <simpara>gitnamespaces - Git namespaces</simpara>\r
12 </simplesect>\r
13 <simplesect id="gitnamespaces(7)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout>GIT_NAMESPACE=&lt;namespace&gt; <emphasis>git upload-pack</emphasis>\r
17 GIT_NAMESPACE=&lt;namespace&gt; <emphasis>git receive-pack</emphasis></literallayout>\r
18 </blockquote>\r
19 </simplesect>\r
20 <simplesect id="gitnamespaces(7)__description">\r
21 <title>DESCRIPTION</title>\r
22 <simpara>Git supports dividing the refs of a single repository into multiple\r
23 namespaces, each of which has its own branches, tags, and HEAD.  Git can\r
24 expose each namespace as an independent repository to pull from and push\r
25 to, while sharing the object store, and exposing all the refs to\r
26 operations such as <xref linkend="git-gc(1)" />.</simpara>\r
27 <simpara>Storing multiple repositories as namespaces of a single repository\r
28 avoids storing duplicate copies of the same objects, such as when\r
29 storing multiple branches of the same source.  The alternates mechanism\r
30 provides similar support for avoiding duplicates, but alternates do not\r
31 prevent duplication between new objects added to the repositories\r
32 without ongoing maintenance, while namespaces do.</simpara>\r
33 <simpara>To specify a namespace, set the <emphasis>GIT_NAMESPACE</emphasis> environment variable to\r
34 the namespace.  For each ref namespace, git stores the corresponding\r
35 refs in a directory under <emphasis>refs/namespaces/</emphasis>.  For example,\r
36 <emphasis>GIT_NAMESPACE=foo</emphasis> will store refs under <emphasis>refs/namespaces/foo/</emphasis>.  You\r
37 can also specify namespaces via the <emphasis>--namespace</emphasis> option to\r
38 <xref linkend="git(1)" />.</simpara>\r
39 <simpara>Note that namespaces which include a <emphasis>/</emphasis> will expand to a hierarchy of\r
40 namespaces; for example, <emphasis>GIT_NAMESPACE=foo/bar</emphasis> will store refs under\r
41 <emphasis>refs/namespaces/foo/refs/namespaces/bar/</emphasis>.  This makes paths in\r
42 <emphasis>GIT_NAMESPACE</emphasis> behave hierarchically, so that cloning with\r
43 <emphasis>GIT_NAMESPACE=foo/bar</emphasis> produces the same result as cloning with\r
44 <emphasis>GIT_NAMESPACE=foo</emphasis> and cloning from that repo with <emphasis>GIT_NAMESPACE=bar</emphasis>.  It\r
45 also avoids ambiguity with strange namespace paths such as <emphasis>foo/refs/heads/</emphasis>,\r
46 which could otherwise generate directory/file conflicts within the <emphasis>refs</emphasis>\r
47 directory.</simpara>\r
48 <simpara><xref linkend="git-upload-pack(1)" /> and <xref linkend="git-receive-pack(1)" /> rewrite the\r
49 names of refs as specified by <emphasis>GIT_NAMESPACE</emphasis>.  git-upload-pack and\r
50 git-receive-pack will ignore all references outside the specified\r
51 namespace.</simpara>\r
52 <simpara>The smart HTTP server, <xref linkend="git-http-backend(1)" />, will pass\r
53 GIT_NAMESPACE through to the backend programs; see\r
54 <xref linkend="git-http-backend(1)" /> for sample configuration to expose\r
55 repository namespaces as repositories.</simpara>\r
56 <simpara>For a simple local test, you can use <xref linkend="git-remote-ext(1)" />:</simpara>\r
57 <screen>git clone ext::'git --namespace=foo %s /tmp/prefixed.git'</screen>\r
58 </simplesect>\r
59 <simplesect id="gitnamespaces(7)__security">\r
60 <title>SECURITY</title>\r
61 <simpara>Anyone with access to any namespace within a repository can potentially\r
62 access objects from any other namespace stored in the same repository.\r
63 You can't directly say "give me object ABCD" if you don't have a ref to\r
64 it, but you can do some other sneaky things like:</simpara>\r
65 <orderedlist numeration="arabic">\r
66 <listitem>\r
67 <simpara>\r
68 Claiming to push ABCD, at which point the server will optimize out the\r
69   need for you to actually send it. Now you have a ref to ABCD and can\r
70   fetch it (claiming not to have it, of course).\r
71 </simpara>\r
72 </listitem>\r
73 <listitem>\r
74 <simpara>\r
75 Requesting other refs, claiming that you have ABCD, at which point the\r
76   server may generate deltas against ABCD.\r
77 </simpara>\r
78 </listitem>\r
79 </orderedlist>\r
80 <simpara>None of this causes a problem if you only host public repositories, or\r
81 if everyone who may read one namespace may also read everything in every\r
82 other namespace (for instance, if everyone in an organization has read\r
83 permission to every repository).</simpara>\r
84 </simplesect>\r
85 </sect2>\r