参考:
http://www.infoq.com/cn/articles/Gerrit-jenkins-hudson
http://fatalove.iteye.com/blog/1332881
1. root@pc11307-HP:~/gerrit_sites/bin# ./gerrit.sh start
./gerrit.sh: 22: GERRIT_SITE: not found
解决方法:
cd /etc/default/
echo "GERRIT_SITE=/home/zww/gerrit_sites" > gerritcodereview
chmod 777 gerritcodereview
chown zww:zww gerritcodereview
重新启动apache2
./gerrit.sh start
2. java -jar ./soft/gerrit-2.4.2.war init -d /home/zww/gerrit_sites
*** Gerrit Code Review 2.4.2
***
*** Git Repositories
***
Location of Git repositories [git]:
*** SQL Database
***
Database server type [H2/?]:
*** User Authentication
***
Authentication method [HTTP/?]:
Get username from custom HTTP header [Y/n]? N
SSO logout URL :
*** Email Delivery
***
SMTP server hostname [smtp.hoperun.com]:
SMTP server port [25]:
SMTP encryption [NONE/?]:
SMTP username [zww]:
Change zww's password [y/N]?
*** Container Process
***
Run as [root]:
Java runtime [/home/zww/jdk1.6.0_27/jre]:
Upgrade /home/zwwi/gerrit_sites/bin/gerrit.war [Y/n]?
Copying gerrit.war to /home/zww/gerrit_sites/bin/gerrit.war
*** SSH Daemon
***
Listen on address [*]:
Listen on port [29418]:
*** HTTP Daemon
***
Behind reverse proxy [y/N]?
Proxy uses SSL (https://) [y/N]?
Subdirectory on proxy server [/]:
Listen on address [127.0.0.1]:
Listen on port [8088]:
Initialized /home/zww/gerrit_sites
注意:(1)配置的【】里面的Y/n,默认配置是大写的字母!!!
(2)web页面退出时报错,这是由于http认证引起的。
(3)时报错
Applation Error
Server Error
SMTP server rejected auth: 535 5.7.0 Error: authentication failed: authentication failure解决方法:[sendemail]
enable = true
smtpServer = smtp.hoperun.com
smtpServerPort = 25
smtpUser = zww@hoperun.com
smtpPass =xxx
sslVerify = false
gerrit init 时会将smtpPass 保存在etc/secure.config中,如果修改密码,要修改该文件中的配置。
最后 gerrit.conf banben:
[gerrit]
basePath = git
[database]
type = H2
database = db/ReviewDB
[auth]
type = HTTP
[sendemail]
enable = true
smtpServer = smtp.hoperun.com
smtpServerPort = 25
smtpUser = zww@hoperun.com
smtpPass = XXX
sslVerify = false
from = Code Review <zww@hoperun.com>
[container]
user = zww
javaHome = /home/zww/jdk1.6.0_27/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://*:8088/
[cache]
directory = cache
3.登录后,在setting/Contact Information中配置fullname 和Register New Email。
Register New Emai时要注意,填完邮箱后点Register,所设置的邮箱就会收到Email Verification。里面会有链接,类似
$email.gerritUrl#/VE/qYFPf7nEH2whjyv27BQbhPrCKzQHc0zUw1/eeA==$MTAwMDAwMjp6b3Vfd2Vpd2VpQGhvcGVydW4uY29t,打开该链接(若不能打开的,新开一个浏览器,将url拷贝到浏览器的url栏中,并将$email.gerritUrl改为gerritUrl/(gerrit的访问地址,‘/’不能漏掉)),就会看到邮箱出现在web左上方用户名后面。貌似只有显示出来才可以接受的邮件。