Gerrit on Freebsd 8

準備好jdk16 on Freebsd之後,可以開始動工了

ref:

Initialize the Site
sudo adduser gerrit2
sudo su gerrit2
cd ~gerrit2
fetch http://gerrit.googlecode.com/files/gerrit-2.1.1.1.war
java -jar gerrit-2.1.1.1.war init -d review_site
依照步驟設定database, ssh, http...etc

Start/Stop Daemon - ssh跟http的服務在此時啟動
review_site/bin/gerrit.sh start
review_site/bin/gerrit.sh stop
review_site/bin/gerrit.sh restart
我這台機器的perl,會導致gerrit.sh無法start
因此刪除或註解這幾行 in review_site/bin/gerrit.sh
if test -x /usr/bin/perl ; then
  # If possible, use Perl to mask the name of the process so its
  # something specific to us rather than the generic 'java' name.
  #
  RUN_EXEC=/usr/bin/perl  
  RUN_Arg1=-e
  RUN_Arg2='$x=shift @ARGV;exec $x @ARGV;die $!'
  RUN_Arg3="-- $JAVA GerritCodeReview"
else
fi
Project Setup
Open browser to connect http://domain:8080/#admin,projects
第一次進去網頁時或在Setting可設定Contact Information, SSH Keys
Contact Information > full name
SSH Keys > SSH Username, Add Key and copy server host key to local machine
generate key的部份參考http://github.com/guides/providing-your-ssh-key
Setting git config at local machine
git config --global user.name "Contact Information的full name"
git config --global user.email "Contact Information的email"
這些設定儲存在~/.gitconfig,此外這設定可解決git push的"you are not committer"的問題
Create repository through ssh
ssh -p 29418 review.example.com gerrit create-project --name new/project
Setting the repository permission through web ui
Admin > projects > choose project name > Access > Add Access Right
新增Verify及Push Branch
Get the repository
git clone ssh://username@domain:29418/projectname
if this project is empty
cd projectname
work...
git add .
git commit -m 'comment'
git push origin master
Create change
cd projectname
git add .
git commit -m 'comment'
git push ssh://username@domain:29418/projectname HEAD:refs/for/master
Create branch
cd projectname
git branch branchname //建立branch
git push ssh://username@domain:29418/projectname branchname



留言

  1. 你好,

    請問一下

    如果我要把舊有的codebase移到gerrit上,因為codebase裡頭有很多repository,我有辦法一次把這些repository push上去嘛?而不用在gerrit一個個create project。

    謝謝

    回覆刪除
  2. hi, 你好

    假設原本的git server資料放在git/裡

    我猜想可以直接把git/裡面所有檔案,複製到gerrit/git/裡面

    之後重新java -jar gerrit-2.1.1.1.war init -d gerrit/

    印象中可以這樣做,但尚未驗證,給你參考看看

    回覆刪除

張貼留言

熱門文章