Git on MAC [By Homebrew]
Install XCode for (GCC tools)
Install Homebrew
ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
Install Git (By homebrew)
brew install git
brew list
brew list git
Git on MAC [By Macports]
Install Macports
Install Git (By Macports)
sudo port install git-core
Gerrit on MAC:
Install MYSQL
- Get Mysql from official site (Mysql Community version)
Get Mysql Java Connector (Connector/J, .jar)
- Copy to /Library/Java/Extensions/
Setup Mysql-DB
mysql -u root -p CREATE USER 'gerrit'@'localhost' IDENTIFIED BY 'password'; CREATE DATABASE reviewdb; ALTER DATABASE reviewdb charset=latin1; GRANT ALL ON reviewdb.* TO 'gerrit'@'localhost'; FLUSH PRIVILEGES;
Get Gerrit from http://code.google.com/p/gerrit/downloads/list
Install Gerrit
java -jar gerrit.war init -d review_sit
Setup Gerrit Authentication by Http
Setup Apache /etc/apache2/httpd.conf as:
Listen 9090 #Gerrit Reverse Apache for Authentication <VirtualHost *:9090> ServerName Gerrit ProxyRequests Off ProxyVia Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> <Location /gerrit/login/> AuthType Basic AuthName "Gerrit Code Review" AuthBasicProvider file AuthUserFile /Users/shiunyi/gerrit/review_site/etc/gerrit.passwd Require valid-user </Location> ProxyPass /gerrit/ http://localhost:8081/gerrit/ </VirtualHost>
Setup account of Gerrit
htpasswd -m /Users/shiunyi/gerrit/review_site/etc/gerrit.passwd NeilLee
Start Gerrit
gerrit/review_site/bin/gerrit.sh start
Web login
gerrit.config
[gerrit] basePath = git [database] type = MYSQL hostname = localhost database = reviewdb username = gerrit [auth] type = HTTP [sendemail] enable = true smtpServer = smtp.gmail.com smtpServerPort = 465 smtpEncryption = SSL smtpUser = user@gmail.com smtpPass = user = gerrit javaHome = /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home [sshd] listenAddress = *:29418 [httpd] listenUrl = proxy-http://*:8081/gerrit [cache] directory = cache
Using Gerrit
SSH authentication
client:
ssh-keygen -t rsa pbcopy < ~/.ssh/id_rsa.pub
Gerrit server:
- Add your ssh key to gerrit
- Restart gerrit server
Gerrit client:
ssh -p 29418 <your username in gerrit>@<gerrit's IP>