Merge lp:~tribaal/serverguide/add-git-to-vcs into lp:~ubuntu-core-doc/serverguide/saucy

Proposed by Chris Glass
Status: Merged
Approved by: Doug Smythies
Approved revision: 145
Merged at revision: 143
Proposed branch: lp:~tribaal/serverguide/add-git-to-vcs
Merge into: lp:~ubuntu-core-doc/serverguide/saucy
Diff against target: 148 lines (+130/-1)
1 file modified
serverguide/C/vcs.xml (+130/-1)
To merge this branch: bzr merge lp:~tribaal/serverguide/add-git-to-vcs
Reviewer Review Type Date Requested Status
Doug Smythies Approve
Review via email: mp+168684@code.launchpad.net

Commit message

This branch adds a git section to the serverguide.

Description of the change

This branch adds a git section to the serverguide.

Furthermore, it adds instructions to install, configure and use "gitolite", a git server that handles advanced features like multi-tenants and access rights in a more complete and convenient way than using the bare git program with shell users.

Please review carefully.

To post a comment you must log in.
Revision history for this message
Doug Smythies (dsmythies) wrote :

Hi Chris, Thanks for your contribution with this.

It does not pass validation. Please review the validation step 4 under "kickstart" on the serverguide wiki page. I did not look into why it does not pass.

review: Needs Fixing
145. By Chris Glass

Fixed dumb typo and forgotten para

Revision history for this message
Chris Glass (tribaal) wrote :

Should pass now - at least to the same extent than other sections: it seems the validation script does not like cross-references.

Revision history for this message
Doug Smythies (dsmythies) wrote :

I see that the references section is inconsistent with other reference sections, but I see it has been like that for a long time. We could look at that sometime later, if desired.

It all looks good to me, but I am not an expert on git.
Peter: Do you want to have a look, or should I go ahead and merge it?

Side note: I got the bzr branch I was originally using completely messed up trying to update to Chris' version 145, and I had to start again from a fresh branch. Can anybody tell me the way to properly include the 145 revision when I am already at the 144 revision (uncommitted)?

review: Approve
Revision history for this message
Doug Smythies (dsmythies) wrote :

I made the references consistent with other chapters.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'serverguide/C/vcs.xml'
2--- serverguide/C/vcs.xml 2013-06-09 21:35:25 +0000
3+++ serverguide/C/vcs.xml 2013-06-11 15:22:08 +0000
4@@ -75,6 +75,133 @@
5 http://bazaar-vcs.org/LaunchpadIntegration</ulink>.</para>
6 </sect2>
7 </sect1>
8+
9+ <sect1 id="git" status="review">
10+ <title>Git</title>
11+
12+ <para>Git is an open source distributed version control system originally developped by Linus Torvalds to support the development of the linux kernel.
13+ Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities,
14+ not dependent on network access or a central server.</para>
15+
16+ <sect2 id="git-installation" status="review">
17+ <title>Installation</title>
18+ <para>
19+ The <application>git</application> version control system is installed with the following command
20+ </para>
21+<screen>
22+<command>sudo apt-get install git-core</command>
23+</screen>
24+ </sect2>
25+ <sect2 id="git-configuration" status="review">
26+ <title>Configuration</title>
27+ <para>Every git user should first introduce herself to git, by running these two commands:</para>
28+<screen>
29+<command>git config --global user.email "you@example.com"</command>
30+<command>git config --global user.name "Your Name"</command>
31+</screen>
32+ </sect2>
33+ <sect2 id="git-usage" status="review">
34+ <title>Basic usage</title>
35+ <para>The above is already sufficient to use git in a distributed and secure way, provided users have access to the machine assuming the server role via SSH. On
36+ the server machine, creating a new repository can be done with</para>
37+<screen>
38+<command>git init --bare /path/to/repository</command>
39+</screen>
40+<note><para>This creates a bare repository, that cannot be used to edit files directly. If you would rather have a working copy of the contents of the repository on the server, ommit the <emphasis>--bare</emphasis> option.</para></note>
41+ <para>Any client with ssh access to the machine can from then on clone the repository with</para>
42+<screen>
43+<command>git clone username@hostname:/path/to/repository</command>
44+</screen>
45+ <para>
46+ Once cloned to the client's machine, the client can edit files, then commit and share them with:
47+ </para>
48+<screen>
49+<command>cd /path/to/repository</command>
50+<command>#(edit some files</command>
51+<command>git commit -a # Commit all changes to the local version of the repository</command>
52+<command>git push origin master # Push changes to the server's version of the repository</command>
53+</screen>
54+
55+ </sect2>
56+ <sect2 id="git-installing-gitolite" status="review">
57+ <title>Installing a gitolite server</title>
58+ <para>
59+ While the above is sufficient to create, clone and edit repositories, users wanting to install git on a server will most likely want to have git work like a more
60+ traditional source control management server, with multiple users and access rights management.
61+ The suggested solution is to install <application>gitolite</application> with the following command:
62+ </para>
63+<screen>
64+<command>sudo apt-get install gitolite</command>
65+</screen>
66+
67+ </sect2>
68+ <sect2 id="git-configuring-gitolite" status="review">
69+ <title>Gitolite configuration</title>
70+ <para>
71+ Configuration of the <application>gitolite</application> server is a little different that most other servers on Unix-like systems.
72+ Instead of the traditional configuration files in /etc/, gitolite stores its configuration in a git repository.
73+ The first step to configuring a new installation is therefore to allow access to the configuration repository.
74+ </para>
75+ <para>
76+ First of all, let's create a user for gitolite to be accessed as.
77+ </para>
78+<screen>
79+<command>sudo adduser --system --shell /bin/bash --group --disabled-password --home /home/git git</command>
80+</screen>
81+ <para>
82+ Now we want to let gitolite know about the repository administrator's public SSH key. This assumes that the current user is the repository administrator.
83+ </para>
84+<screen>
85+<command>cp ~/.ssh/id_rsa.pub /tmp/$(whoami).pub</command>
86+</screen>
87+ <para>
88+ Let's switch to the git user and import the administrator's key into gitolite.
89+ </para>
90+<screen>
91+<command>sudo su - git</command>
92+<command>gl-setup /tmp/*.pub</command>
93+</screen>
94+ <para>
95+ Gitolite will allow you to make initial changes to its configuration file during the setup process. You can now clone and modify the gitolite configuration repository from your administrator user (the user whose public SSH key you imported). Switch back to that user, then clone the configuration repository:
96+ </para>
97+<screen>
98+<command>exit</command>
99+<command>git clone git@$IP_ADDRESS:gitolite-admin.git</command>
100+<command>cd gitolite-admin</command>
101+</screen>
102+ <para>The gitolite-admin contains to subdirectories, "conf" and "keydir". The configuration files are in the conf dir, and the keydir directory contains the list of user's public SSH keys.</para>
103+ </sect2>
104+ <sect2 id="git-gitolite-management" status="review">
105+ <title>Managing gitolite users and repositories</title>
106+ <para>Adding new users to gitolite is simple: just obtain their public SSH key and add it to the keydir directory as $DESIRED_USER_NAME.pub. Note that the the gitolite usernames don't have to match the system usernames - they are only used in the gitolite configuration file to manage access control. Similarly, users are deleted by deleting their public key file. After each change, do not forget to commit the changes to git, and push the changes back to the server with</para>
107+<screen>
108+<command>git commit -a</command>
109+<command>git push origin master</command>
110+</screen>
111+ <para>Reporitories are managed by editing the conf/gitolite.conf file. The syntax is space separated, and simply specifies the list of repositories followed by some access rules. The following is a default example</para>
112+<programlisting>
113+repo gitolite-admin
114+ RW+ = admin
115+ R = alice
116+
117+repo project1
118+ RW+ = alice
119+ RW = bob
120+ R = denise
121+</programlisting>
122+ </sect2>
123+ <sect2 id="git-gitolite-usage" status="review">
124+ <title>Using your server</title>
125+ <para>To use the newly created server, users have to have the gitolite admin import their public key into the gitolite configuration repository, they can then access any project they have access to with the following command:</para>
126+<screen>
127+<command>git clone git@$SERVER_IP:$PROJECT_NAME.git</command>
128+</screen>
129+ <para>Or add the server's project as a remote for an existing git repostory:</para>
130+<screen>
131+<command>git remote add gitolite git@$SERVER_IP:$PROJECT_NAME.git</command>
132+</screen>
133+ </sect2>
134+ </sect1>
135 <sect1 id="subversion" status="review">
136 <title>Subversion</title>
137 <para>
138@@ -403,7 +530,9 @@
139 <sect1 id="version-control-ref" status="review">
140 <title>References</title>
141 <para><ulink url="http://bazaar.canonical.com/en/">Bazaar Home Page</ulink></para>
142- <para><ulink url="https://launchpad.net/">Launchpad</ulink></para>
143+ <para><ulink url="https://launchpad.net/">Launchpad</ulink></para>
144+ <para><ulink url="http://git-scm.com">Git homepage</ulink></para>
145+ <para><ulink url="https://github.com/sitaramc/gitolite">Gitolite</ulink></para>
146 <para><ulink url="http://subversion.tigris.org/">Subversion Home Page</ulink></para>
147 <para><ulink url="http://svnbook.red-bean.com/">Subversion Book</ulink></para>
148 <para><ulink url="https://help.ubuntu.com/community/EasyBazaar">Easy Bazaar Ubuntu Wiki page</ulink></para>

Subscribers

People subscribed via source and target branches