gitnamespaces.txt 2.4 KB

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