Gerrit 简明教程
Gerrit - Installing Git-Review
您可以按照本章中所述,通过在各个平台安装 git-review 来使用 Gerrit。
You can work with Gerrit by installing git-review on different platforms as discussed in this chapter.
Windows
在 Windows 中,您可以按以下步骤安装 git-review。
In Windows, you can install the git-review as listed in the following steps.
Step 1 − 首先安装 Python 以安装 git-review。
Step 1 − First install Python for installing git-review.

Step 2 − 在默认目录(如 C:\Python27)保留 Python 安装,而不是安装在其他目录中。
Step 2 − Keep the Python installation in the default directory (like C:\Python27) instead of installing in any other directory.
Step 3 − 接着,使用路径 C:\Python27\;C:\Python27\Scripts\; 设置 Python 脚本目录的环境变量
Step 3 − Next, set the environment variables for Python scripts directory using the path as C:\Python27\;C:\Python27\Scripts\;
git_review_install
Step 4 − 在版本 2.7 中,Python 将自动安装 pip。对于旧版本的 Python 2.7,您可以按照此 link 中所述安装 pip。
Step 4 − With version 2.7, Python will install pip automatically. For older version of Python 2.7, you can install pip as described in this link.
Step 5 − 运行开放 Git Bash,并使用如下命令安装 git-review。
Step 5 − Run open Git Bash and install the git-review using the following command.
$ pip install git-review
Linux
在 Linux 中,您可以按照以下步骤安装 git-review −
In Linux, you can install git-review as described in the following steps −
Step 1 Linux 平台的用户在共享主机上没有 root 访问权限。因此,如果您没有 root 访问权限,您可以使用如下命令在用户目录中本地安装 git-review −
Step 1 Users of Linux platform do not have root access on shared host. Hence, without root access, you can install git-review locally in user directory using the following commands −
virtualenv --python=/usr/bin/python2.6 virtualenv
virtualenv/bin/pip install git-review==1.21
Step 2 − 您可以使用两种方式扩展到本地二进制文件的路径 −
Step 2 − You can extend the path to the local binaries using two ways −
PATH=$PATH:~/virtualenv/bin/
PATH=~/virtualenv/bin/:$PATH
Step 3 − 现在,使用如下命令设置使用 Gerrit 的工作。
Step 3 − Now, use the following command to set up the work with Gerrit.
git review -s
or
~/virtualenv/bin/git-review -s
Step 4 − 对于 root 访问权限,可以使用如下命令安装 git-review。
Step 4 − With root access, git-review can be installed using the following command.
sudo apt-get install git-review
Step 5 − 如果在安装 Python 后没有 apt-get,那么使用如下命令。
Step 5 − If there is no apt-get after installing Python, then use the following commands.
$ sudo easy_install pip
$ sudo pip install git-review==1.21
Step 6 − 运行以下命令使用 Gerrit。
Step 6 − Run the following command to work with Gerrit.
git review -s
Mac OS X
在 Mac 中,你可以使用以下步骤安装 git-review。
In Mac, you can install the git-review using the following steps.
Step 1 − 从此处安装 Homebrew link.
Step 1 − Install the Homebrew from this link.
Step 2 − 接着,使用以下命令安装 git-review。
Step 2 − Next, install the git-review using the following command.
brew install git-review