$ cd ~/gerrit $ export GERRIT_SITE=~/gerrit/gerrit_testsite $ java -jar gerrit*.war init --batch --dev -d $GERRIT_SITE $ java -jar gerrit*.war init -d $GERRIT_SITE Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore [2023-04-02 09:58:38,456] [main] INFO com.google.gerrit.server.config.GerritServerConfigProvider : No /root/gerrit/gerrit_testsite/etc/gerrit.config; assuming defaults
*** Gerrit Code Review 3.7.2 ***
*** Git Repositories ***
Location of Git repositories [git]:
*** JGit Configuration ***
*** Index ***
Type [lucene]:
*** User Authentication ***
Authentication method [openid/?]: oauth Git/HTTP authentication [http/?]: Enable signed push support [y/N]?
*** Review Labels ***
Install Verified label [y/N]? y
*** Email Delivery ***
SMTP server hostname [localhost]: smtp.163.com SMTP server port [(default)]: SMTP encryption [none/?]: SMTP username [root]: XXXXXXXXX@163.com XXXXXXXXX@163.com's password : confirm password : *** Container Process *** Run as [root]: Java runtime [/usr/lib/jvm/java-11-openjdk-11.0.16.0.8-1.el7_9.x86_64]: Copy gerrit-3.7.2.war to /root/gerrit/gerrit_testsite/bin/gerrit.war [Y/n]? Copying gerrit-3.7.2.war to /root/gerrit/gerrit_testsite/bin/gerrit.war *** SSH Daemon *** Listen on address [*]: Listen on port [29418]: Generating SSH host key ... rsa... ed25519... ecdsa 256... ecdsa 384... ecdsa 521... done *** HTTP Daemon *** Behind reverse proxy [y/N]? Use SSL (https://) [y/N]? y Listen on address [*]: 127.0.0.1 Listen on port [8443]: 8081 Canonical URL [https://127.0.0.1:8081/]: http://192.168.30.8:8081 Create new self-signed SSL certificate [Y/n]? Certificate server name [192.168.30.8:8081]: Certificate expires in (days) [365]: 36500 *** Cache *** *** Plugins *** Installing plugins. Install plugin codemirror-editor version v3.7.2 [y/N]? y Installed codemirror-editor v3.7.2 Install plugin commit-message-length-validator version v3.7.2 [y/N]? y Installed commit-message-length-validator v3.7.2 Install plugin delete-project version v3.7.2 [y/N]? y Installed delete-project v3.7.2 Install plugin download-commands version v3.7.2 [y/N]? y Installed download-commands v3.7.2 Install plugin gitiles version v3.7.2 [y/N]? y Installed gitiles v3.7.2 Install plugin hooks version v3.7.2 [y/N]? y Installed hooks v3.7.2 Install plugin plugin-manager version v3.7.2 [y/N]? y Installed plugin-manager v3.7.2 Install plugin replication version v3.7.2 [y/N]? y Installed replication v3.7.2 Install plugin reviewnotes version v3.7.2 [y/N]? y Installed reviewnotes v3.7.2 Install plugin singleusergroup version v3.7.2 [y/N]? y Installed singleusergroup v3.7.2 Install plugin webhooks version v3.7.2 [y/N]? y Installed webhooks v3.7.2 Initializing plugins. ============================================================================ Welcome to the Gerrit community Find more information on the homepage: https://www.gerritcodereview.com Discuss Gerrit on the mailing list: https://groups.google.com/g/repo-discuss ============================================================================ Initialized /root/gerrit/gerrit_testsite $
其中 ~/gerrit 是我的gerrit安装路径,出现 Starting Gerrit Code Review: OK 表示启动成功。
################################################## # No GERRIT_SITE yet? We're out of luck! ################################################## iftest -z "$GERRIT_SITE" ; then GERRIT_SITE="/root/gerrit/gerrit_testsite" fi
然后执行:
1 2
$ chkconfig --add gerrit.sh $ chkconfig gerrit.sh on
$ touch /root/gerrit/gerrit_testsite/etc/gerrit.password $ htpasswd -c /root/gerrit/gerrit_testsite/etc/gerrit.password admin New password: Re-type new password: Adding password for user admin
$ ssh-keygen -t ed25519 -C "123456789@qq.com" Generating public/private ed25519 key pair. Enter file inwhich to save the key (/c/Users/10287/.ssh/id_ed25519): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_ed25519 Your public key has been saved in id_ed25519.pub The key fingerprint is: SHA256:Ufs5p/nzaZ7dKQG8un2IRYkClI+Ro4+oT0f/8cCd+VE 123456789@qq.com The key's randomart image is: +--[ED25519 256]--+ | ..o . | | * . . | | . * . + . | | . . o o * . | | . + S . * E | | . o o . . = B | |. . . . + B = . | |.. . . *.o =..*| | .. ..o.o =B+| +----[SHA256]-----+
$ echotest > test.txt $ git status On branch master Your branch is up to date with 'origin/master'.
Untracked files: (use "git add <file>..." to include in what will be committed) test.txt
nothing added to commit but untracked files present (use "git add" to track) $ git add test.txt warning: in the working copy of 'test.txt', LF will be replaced by CRLF the next time Git touches it $ git commit -m "gerrit提交测试" [master 6e78c4e] gerrit提交测试 1 file changed, 1 insertion(+) create mode 100644 test.txt
v1.4.14