- 安装Python,python版本最好选择稳定版本,已验证版本2.7.11 [python2.7.11以上版本自带安装了pip,可以省略步骤4至步骤5]
- 安装Python时,指定的安装路径不能含有空格(已知的Pip Bug)
- 安装完Python后,需要将Python的安装路径添加到系统环境变量Path里(Python安装路径如:C:\Python27)
- 下载get-pip.py文件,下载地址:https://bootstrap.pypa.io/get-pip.py
- 右键选择打开"git bash",进入bash终端后,执行下面命令: python get-pip.py
- 安装完Pip后,需要将Python的Scripts路径添加到系统环境变量Path里(Scripts安装路径如:C:\Python27\Scripts)
- 关闭打开的git bash终端,再重新打开一个新的git bash终端,执行下面命令安装git-review: pip install git-review
- git-review安装完成后,关闭git bash终端
- 在Linux下生成一对秘钥(可以使用已有的秘钥),放在C:\Users\Administrator.ssh目录下(请根据登录windows用户,来确定存放的目录) [步骤9可换成:在git bash终端执行ssh-keygen -t rsa -C "xxxxxx@yy.com" #建议填写自己真实有效的邮箱地址]
- 将生成的公钥信息添加到review.xxxx.com对应用户的SSH Public Keys里
- git clone测试仓库,地址:git@git.xxxx.com:project/gerrit_sample.git
- 在git clone的gerrit_sample目录下,打开git bash终端
- 在打开的git bash终端里,将已经commit的文件,执行下面命令进行review: git review
- 第一次git review时,提示输入用户名,请输入,然后等待提交完成
- 成功后,可以在review.xxxxxx.com上看到review记录
问题: 在window系统上初次执行git review 报错,git 找不到gerrit远程仓库,需要执行 git remote add gerrit ssh://username@review.xxxxxx.com:29418/gerrit_sample.git
错误信息: Could not connect to gerrit. Enter your gerrit username: Trying again with ssh://@review.xxxx.com:29418/gerrit_sample.git <traceback object at 0x0000000003128A48> We don't know where your gerrit is. Please manually create a remote named "gerrit" and try again. Could not connect to gerrit at ssh://@review.xxxxx.com:29418/gerrit_sample.git Traceback (most recent call last): File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "c:\python27\lib\runpy.py", line 72, in run_code exec code in run_globals File "C:\Python27\Scripts\git-review.exe_main.py", line 9, in <module> File "c:\python27\lib\site-packages\git_review\cmd.py", line 1534, in main sys.exit(e.EXIT_CODE) AttributeError: 'GitReviewException' object has no attribute 'EXIT_CODE'