Working with Git and Gerrit » History » Version 29

Bastian Waidelich, 2010-09-05 20:51

1 1 Karsten Dambekalns
h1. Working with Git and Gerrit Code Review
2 22 Karsten Dambekalns
3
{{>toc}}
4 1 Karsten Dambekalns
5
For FLOW3 and TYPO3 Phoenix we are using Git and the Gerrit Code Review system to channel commits for review.
6 20 Karsten Dambekalns
7 29 Bastian Waidelich
Here is what you need to know to contribute, more details on Git are available in the "Pro Git book":http://progit.org/book/, the "Gerrit documentation":https://review.typo3.org/Documentation/index.html and other resources (see "helpful links" section below).
8 1 Karsten Dambekalns
9 28 Karsten Dambekalns
h2. What <projectname> means in this documentation
10
11
When we use <projectname> in the following documentation and examples, this means the project name as used in gerrit. If you are unsure you can find out the correct URL to clone from by going to git.typo3.org and copy it from the summary page of the project you're interested in. Here are some examples of <projectname>:
12
13
 FLOW3/Distributions/Base
14
FLOW3/Packages/Party
15
TYPO3v5/Distributions/Base
16
17 26 Karsten Dambekalns
h2. Quickstart Guides
18 1 Karsten Dambekalns
19 26 Karsten Dambekalns
* For a quick "Getting Started" guide, see the [[Gerrit and Git Quickstart]]
20
* Here is a transcript of a session [[Cloning the FLOW3 Base Distribution]]
21
* Here is a transcript of a session [[Cloning the TYPO3 Phoenix Base Distribution]]
22 25 Sebastian Kurfuerst
23 26 Karsten Dambekalns
*Note:* Take time to learn and explore git and gerrit!
24
25 1 Karsten Dambekalns
h2. Git
26 24 Karsten Dambekalns
27 1 Karsten Dambekalns
h3. [[Working with Git]]
28
29 24 Karsten Dambekalns
h2. Gerrit Code Review
30 1 Karsten Dambekalns
31
h3. Registering with gerrit
32
33 26 Karsten Dambekalns
To register with gerrit, you need to have an account on typo3.org. Then visit https://review.typo3.org/ and log in using your typo3.org username and password. Click on 'Settings' -> 'Profile', and check that gerrit correctly knows your name and email address (it should; if not it might take a while for the synchronization to take place).
34 1 Karsten Dambekalns
35
In order to be able to upload code, you now need to create a ssh key that gerrit can use to identify you, or tell gerrit about one that already exists.
36
37
To create a new ssh key, if you don't already have one, run
38
<pre>ssh-keygen -t dsa -f ~/.ssh/id_dsa</pre>
39
The public key for this is now stored in ~/.ssh/id_dsa.pub.
40 23 Karsten Dambekalns
41
To tell gerrit about your key, log in, and go to 'Settings'. Select 'SSH Keys', and paste your public key into the "Add SSH Public Key" box, or click on the 'Open Key...' option to load it from the filesystem. Click on 'Add' to add the new public key.
42 27 Karsten Dambekalns
43 1 Karsten Dambekalns
To make things easier, set up ssh so that it knows about the defaults for the gerrit server. Edit @~/.ssh/config@, and add a section like:
44
<pre>Host review.typo3.org 
45 23 Karsten Dambekalns
User <username> 
46 1 Karsten Dambekalns
IdentityFile ~/.ssh/id_dsa 
47
Port 29418</pre>
48 23 Karsten Dambekalns
(where <username> is what you logged in with, i.e. your typo3.org username)
49 1 Karsten Dambekalns
50 23 Karsten Dambekalns
To verify your ssh key is working correctly, try using an ssh client to connect to gerrit. You should get the following output if it all works:
51 1 Karsten Dambekalns
<pre>$ ssh review.typo3.org
52 23 Karsten Dambekalns
gerrit: no shell available
53
Connection to review.typo3.org closed.</pre>
54 4 Karsten Dambekalns
55 24 Karsten Dambekalns
h3. [[Working with Gerrit as a Developer]]
56 4 Karsten Dambekalns
57 1 Karsten Dambekalns
h3. [[Working with Gerrit as a Reviewer]]
58 29 Bastian Waidelich
59
h2. Helpful links
60
61
* "Git Homepage":http://www.git-scm.com/
62
* "Pro Git book":http://progit.org/book/
63
* "Git ready - tutorials":http://gitready.com/
64
* "Gerrit documentation":https://review.typo3.org/Documentation/index.html
65 4 Karsten Dambekalns
66
h2. Thanks
67 1 Karsten Dambekalns
68
... to the folks over at "OpenAFS":http://openafs.org/ that made us stumble over gerrit and whose wiki page we shamelessly used as a base for this page.
69 2 Karsten Dambekalns
70
... to Sebastian Kurf├╝rst, Peter Niederlag, Christopher Hlubek for their help with git, gerrit and redmine.
71
72 23 Karsten Dambekalns
... Bastian Waidelich for being the brave Windows test user.
73 26 Karsten Dambekalns
74
... to Shawn Pearce for being helpful on the gerrit mailing list.
75 5 Karsten Dambekalns
76 1 Karsten Dambekalns
... to the TYPO3 Core Team for being open towards a change in SCM flavor.