Actions

Working with Git and Gerrit » History » Revision 30

« Previous | Revision 30/46 (diff) | Next »
Karsten Dambekalns, 2011-02-24 20:40
Added hint about pushInsteadOf config


Working with Git and Gerrit Code Review

For FLOW3 and TYPO3 Phoenix we are using Git and the Gerrit Code Review system to channel commits for review.

Here is what you need to know to contribute, more details on Git are available in the Pro Git book, the Gerrit documentation and other resources (see "helpful links" section below).

What <projectname> means in this documentation

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>:

FLOW3/Distributions/Base
FLOW3/Packages/Party
TYPO3v5/Distributions/Base

Quickstart Guides

Note: Take time to learn and explore git and gerrit!

Git

Working with Git

Gerrit Code Review

Registering with gerrit

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).

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.

To create a new ssh key, if you don't already have one, run

ssh-keygen -t dsa -f ~/.ssh/id_dsa

The public key for this is now stored in ~/.ssh/id_dsa.pub.

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.

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:

Host review.typo3.org 
User <username> 
IdentityFile ~/.ssh/id_dsa 
Port 29418

(where <username> is what you logged in with, i.e. your typo3.org username)

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:

$ ssh review.typo3.org
gerrit: no shell available
Connection to review.typo3.org closed.

Now you can configure git to push to Gerrit whenever you clone something from git.tyo3.org. All you need to do (for git > 1.6.4) is this

git config --global url."ssh://review.typo3.org".pushInsteadOf git://git.typo3.org

Now you can clone from git://git.typo3.org and a push on that clone would go into ssh://git.typo3.org using your configure username and port from above.

Working with Gerrit as a Developer

Working with Gerrit as a Reviewer

Helpful links

Thanks

... to the folks over at OpenAFS that made us stumble over gerrit and whose wiki page we shamelessly used as a base for this page.

... to Sebastian Kurfürst, Peter Niederlag, Christopher Hlubek for their help with git, gerrit and redmine.

... Bastian Waidelich for being the brave Windows test user.

... to Shawn Pearce for being helpful on the gerrit mailing list.

... to the TYPO3 Core Team for being open towards a change in SCM flavor.

Updated by Karsten Dambekalns almost 10 years ago · 30 revisions