关闭

gerrit+git codereivew install

902人阅读 评论(0) 收藏 举报

About gerrit:

http://code.google.com/p/gerrit/

Install Doc:

https://gerrit-documentation.storage.googleapis.com/Documentation/2.7/install-quick.html


Steps:

1. download war from : http://gerrit-releases.storage.googleapis.com/index.html

2. copy to ~/, and rename to gerrit.war.

3. adduser gerrit2. (In macos: sudo dscl . add )

4. sudo su gerrit2.

    java -jar gerrit.war init -d sitename

5. run: sitename/bin/gerrit.sh start.

6. signature: ssh-keygen -t rsa.

----------------- 

7. If select openid when configure, signup first usename 'abc' with an existing openid

8. THEN, ssh login in using: ssh -p 29418 abc@localhost. step 7 is import, otherwise can't ssh to server.


--------------

If new repository:

create on web.

If existing repository:


ssh -p 29418 abc@localhost gerrit create-project --name existing_project

then:

git push ssh://abc@localhost:29418/existing_project *:*


If rejected: ()http://www.infoq.com/cn/articles/Gerrit-jenkins-hudson/

do this:

$ git config remote.origin.push refs/heads/*:refs/for/*
$ git push origin
Counting objects: 3, done.
Writing objects: 100% (3/3), 217 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://demo@localhost:29418/example.git
 * [new branch]      master -> refs/for/master


=======================================

errors:

=======================================

after config proxy in /etc/httpd/conf/httpd.conf:

     ProxyPass / http://127.0.0.1:8081/

and config in review_site/etc/gerrit.cfg:

[httpd]
    listenUrl = proxy-http://*:8081


You still cannot access localhost and error is http error 503: server temoperally unavailable.

Please check you firewall:

/usr/sbin/getsebool -a |grep httpd_can_network_connect
httpd_can_network_connect --> off

So run:

sudo /usr/sbin/setsebool httpd_can_network_connect=1

或者直接关掉selinux:

修改/etc/selinux/config 然后重启:
SELINUX=disabled
or:

run /usr/sbin/setenforce 0

Then try again!


======================================

Add user:

Add an email and SSH key to watcher's account:

$ cat ~/.ssh/id_watcher.pub | ssh -p 29418 review.example.com gerrit set-account --add-ssh-key - --add-email mail@example.com watcher
or:

Create a new batch/role access user account called watcher inthe Non-Interactive Users group.

$ cat ~/.ssh/id_watcher.pub | ssh -p 29418 review.example.com gerrit create-account --group "'Non-Interactive Users'" --ssh-key - watcher

http://fatalove.iteye.com/blog/1332881
====================================================================

有时可能SERVER错误,是因为SELINUX.
-
/etc/sysconfig/selinux
selinux=disable

==========================================================
本地配置。但有时候可以有时不行。

<VirtualHost *>
    #ServerAdmin webmaster@dummy-host.example.com
    #DocumentRoot /www/docs/dummy-host.example.com
    ServerName 127.0.0.1
    #ErrorLog logs/dummy-host.example.com-error_log
    #CustomLog logs/dummy-host.example.com-access_log common

    ProxyRequests Off
    ProxyVia off
    ProxyPreserveHost On

    <Proxy *>
	Order deny,allow
	Allow from all
    </Proxy>

    <Location /login/>
    #<Location "/">
	AuthType Basic
	AuthName "Gerrit Code Review"
	#AuthBasicProvider file
	#AuthUserFile /home/gerrit2/review_site/etc/passwords
	#Require valid-user
    </Location>

    AllowEncodedSlashes On
    ProxyPass / http://127.0.0.1:8081/
    #ProxyPassReverse / http://127.0.0.1:8081/

</VirtualHost>

---- gerrit.config ------

[gerrit]
	basePath = git
	canonicalWebUrl = http://localhost
[database]
	type = h2
	database = db/ReviewDB
[auth]
	type = HTTP
[sendemail]
	smtpServer = localhost
[container]
	user = gerrit2
	javaHome = /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19/jre
[sshd]
	listenAddress = *:29418
[httpd]
	listenUrl = proxy-http://*:8081/
[cache]
	directory = cache


 



===============   TEST  ===================

- install postgresql on centos (具体配置可参考:http://blog.chinaunix.net/uid-24846094-id-78490.html)

sudo yum install postgresql postgresql-server

service postgresql initdb

service postgresql start

-  setup posqgre for gerrit (https://gerrit-documentation.storage.googleapis.com/Documentation/2.7/install.html#createdb_postgres)

----

$ createuser --username=postgres -RDIElPS gerrit2
  $ createdb --username=postgres -E UTF-8 -O gerrit2 reviewdb

可能需要换用户运行,如su postgres


- [尝试用psql -U gerrit2 -h localhost 登录,如果失败:

postgresql Ident authentication failed for user 'gerrit2']

则:打开/va/lib/pgsql/data/pg_hba.conf:

将最后的2个host行最后后ident 改为 md5.

如: host all all 127.0.0.1/32 md5

重启: service postgresql restart.

---------

下载gerrit-2.8.wart后,运行:

java -jar gerrit-2.8.war init -d review_site


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:54605次
    • 积分:939
    • 等级:
    • 排名:千里之外
    • 原创:38篇
    • 转载:42篇
    • 译文:0篇
    • 评论:3条
    最新评论
    其它链接