1 Overview
Gerrit can automatically push anychanges it makes to its managed Git repositories to another system.Typicallyreplication should be done over SSH, with a passwordless public/private keypair.On a trusted network it is also possible to use replication over theinsecure(but much faster)git://protocol, by enabling the receive-pack serviceon the receiving system, but this configuration is not recommended.
2 SSH configuration
You must set up a public/privatekey pair that enables the Gerrit user on the master server to log on to theGerrit user on the slave without a password.
2.1 Create a (password-less) key usingssh-keygen on the master server
(ignore this step , if you alreadyhave one)
gerrit2@masterserver:~$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gerrit2/.ssh/id_rsa):
Created directory '/home/gerrit2/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/gerrit2/.ssh/id_rsa.
Your public key has been saved in /home/gerrit2/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 gerrit2@mastereserver
2.2 Use ssh command to create a directory ~/.sshas user gerrit2 on slave
gerrit2@masterserver:~$ ssh gerri2@slave
gerrit2@slave's password:
2.3 Append gerrit2@masterserver’s newpublic key to gerrit2@slave:.ssh/ authorized_keys and enter gerrit2’spassword one last time
gerrit2@masterserver:~$ cat .ssh/id_rsa.pub | ssh gerrit2@slave 'cat >> .ssh/authorized_keys'
gerrit2@slave's password:
3 Create replication.config
Create '$site_path'/etc/replication.config asa Git-style config file, and restart Gerrit.
3.1 Git protocol
Must set-up install git-daemonfirst.
[remote "slave_mirror "]
url = git://slave/${name}.git
mirror = true
threads = 2
adminUrl = ssh://gerrit2@slave/srv/gerrit2/git/${name}.git
3.2 SSH protocal
[remote "slave "]
url = ssh://gerrit2@slave/srv/gerrit2/git/${name}.git
mirror = true
threads = 2
adminUrl = ssh://gerrit2@slave/srv/gerrit2/git/${name}.git
4 Reference
http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/config-replication.html
http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/cmd-replicate.html
https://groups.google.com/forum/?fromgroups=#!topic/repo-discuss/dmY87yf0X7o
http://www.linuxproblem.org/art_9.html
http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html

2823

被折叠的 条评论
为什么被折叠?



