Gerrit on Freebsd 8
準備好jdk16 on Freebsd之後,可以開始動工了
ref:
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 startreview_site/bin/gerrit.sh stopreview_site/bin/gerrit.sh restart我這台機器的perl,會導致gerrit.sh無法start因此刪除或註解這幾行 in review_site/bin/gerrit.shif 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/perlRUN_Arg1=-eRUN_Arg2='$x=shift @ARGV;exec $x @ARGV;die $!'RUN_Arg3="-- $JAVA GerritCodeReview"elsefi
Project Setup
Open browser to connect http://domain:8080/#admin,projects第一次進去網頁時或在Setting可設定Contact Information, SSH KeysContact Information > full nameSSH Keys > SSH Username, Add Key and copy server host key to local machinegenerate 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/projectnameif this project is emptycd projectnamework...git add .git commit -m 'comment'git push origin master
Create change
cd projectnamegit add .git commit -m 'comment'git push ssh://username@domain:29418/projectname HEAD:refs/for/master
Create branch
cd projectnamegit branch branchname //建立branchgit push ssh://username@domain:29418/projectname branchname
你好,
回覆刪除請問一下
如果我要把舊有的codebase移到gerrit上,因為codebase裡頭有很多repository,我有辦法一次把這些repository push上去嘛?而不用在gerrit一個個create project。
謝謝
hi, 你好
回覆刪除假設原本的git server資料放在git/裡
我猜想可以直接把git/裡面所有檔案,複製到gerrit/git/裡面
之後重新java -jar gerrit-2.1.1.1.war init -d gerrit/
印象中可以這樣做,但尚未驗證,給你參考看看