Gitolite_Setup.mdwn 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. Install the 'gitolite' package using your favorite package manager from the
  2. Debian repositories. It should require 'git' and 'openssh-server' and several
  3. other packages as dependencies (unless they are already installed). On the
  4. command-line this can be done by running the following command as root:
  5. # apt-get install gitolite
  6. When installing gitolite, debconf basically should prompt the user for several
  7. settings. However, due the a [bug] in the stable package, it doesn't happen
  8. automatically. If it did work for you when you installed the package - great.
  9. Otherwise, run the configuration program (as root) after the 'gitolite' package
  10. is installed:
  11. # dpkg-reconfigure gitolite
  12. The first setting you'll be asked to choose is the name of the user which
  13. gitolite will use to access the repositories. It can be any user, but it is
  14. safer to use a separate user. If the specified user doesn't exist, it will be
  15. automatically created.
  16. The default user is gitolite, but personally I prefer to decouple general git
  17. server details from the specific management software I use (gitolite is not the
  18. only one of its kind). Thus, since the gitolite user is the owner of the git
  19. repositories, I give it the name __git__. This is also seems to be the name used
  20. commonly for this purpose in other places.
  21. The second setting you need to fill in is the path where the repositories will
  22. be stored. This will also be the gitolite user's home directory. The default,
  23. /var/lib/gitolite, may be fine for many cases, but you should probably take the
  24. following into consideration:
  25. * __Disk encryption__: If you don't use a single disk partition for your whole
  26. file system, your home directory and the file system root (whose path is
  27. __/__) probably reside in different partitions. It is common to have the home
  28. partition encrypted while the root partition is not, so take that into account
  29. when choosing the path. This has an implication on anonymity: If you host your
  30. repositories on a darknet or in any other anonymous mechanism, storing them on
  31. an encrypted partition may prevent 3rd parties from figuring out who you are
  32. in case they file your lost harddrive. Otherwise it probably doesn't make a
  33. big difference, because your code is going to be available via your new git
  34. server anyway.
  35. * __Available space__: For the same reason explained above, it is common for
  36. home computers to have a large home partition and a smaller root partition
  37. (e.g. 300 GB home partition and 25 GB root partition). Files stored in version
  38. control are usually relatively small, i.e. they aren't binaries (executables,
  39. audio, video), but as repositories grow and new ones are added, this may
  40. become a consideration.
  41. * For the same reason I prefer __git__ as the name of the user, I prefer to not
  42. have 'gitolite' in the path of the repositories.
  43. Note that it is possible to use /var/lib/gitolite (or any other path) and simply
  44. make it a symbolic link which points to the real location of the repositories.
  45. Some common options are:
  46. + /var/lib/gitolite
  47. + /home/git
  48. + /opt/git
  49. + /srv/git
  50. For details on the purpose of the various folders, you can read about the
  51. [Filesystem Hierarchy Standard (FHS)][fhs].
  52. For the purpose of the example, let's use __/home/git__. The repositories
  53. themselves will be stored under a subfolder /home/git/repositories created for
  54. you automatically.
  55. The third and last thing you'll be asked is the SSH key of the administator.
  56. When gitolite is installed on a dedicated server, its configuration is usually
  57. done by connecting to it via SSH from a workstation, e.g. a personal computer of
  58. the developer. The SSH key specified should be the key of the person who will be
  59. in charge of managing the repositories and gitolite's configuration files. For
  60. example, it may be the lead developer or a system administrator or someone in
  61. the team who is hosting the server.
  62. In my case, the same computers multi-function as servers and as user desktops,
  63. so I use my personal SSH key. If the key needs to be sent over to the server
  64. from a remote location, e.g. a personal workstation, you can leave the setting
  65. empty and configure gitolite manually. [[TODO|TODO/OPEN]]
  66. A personal SSH key is commonly stored in your home folder, under the .ssh hidden
  67. folder. This folder usually contains the key as a pair of files:
  68. + /home/alice/.ssh/id_rsa
  69. + /home/alice/.ssh/id_rsa.pub
  70. The first file is your private key, which you should never give to anyone or
  71. send anywhere. The second file is the public key, and this is what you need to
  72. put on the server. If the server runs on your own computer, the key setting can
  73. be the path to the public key: __/home/alice/.ssh/id_rsa.pub__.
  74. After the last setting has been entered, the following message will be presented
  75. in the terminal:
  76. creating gitolite-admin...
  77. Initialized empty Git repository in /home/git/repositories/gitolite-admin.git/
  78. creating testing...
  79. Initialized empty Git repository in /home/git/repositories/testing.git/
  80. [master (root-commit) 5bd9b40] start
  81. 2 files changed, 6 insertions(+)
  82. create mode 100644 conf/gitolite.conf
  83. create mode 100644 keydir/admin.pub
  84. [bug]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699490
  85. [fhs]: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard