先搭建gerrit服务器(https://blog.youkuaiyun.com/mike8825/article/details/79761840)
新建manifests文件夹,并在文件夹创建default.xml文件,内容如下
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote
name="origin"
fetch="ssh://192.168.11.10:29418"
review="192.168.11.10:9999"/>
<default revision="master" remote="origin" />
<project name="test1" path="android/test1"/>
<project name="test2" path="robot/test2"/>
</manifest>
创建工程manifest
ssh -p 29418 admin@192.168.11.10 gerrit create-project manifests
推送到manifests工程
git push ssh://admin@192.168.11.10:29418/manifests *:*
用同样的方法创建test1和test2两个git工程,并上传上去。
这里的用户是gerrit1(gerrrit1已设置了该用户,并且注册了邮件),
下载repo工程
repo init -u ssh://gerrit1@192.168.11.10:29418/manifests
repo sync
下载下来的工程并没有分支,先创建分支
repo start master --all
修改git工程的内容,git commit -am提交。
提交修改到gerrit审核,
repo upload
Upload project android/test1/ to remote branch master:
branch master ( 1 commit, Fri Mar 30 17:58:07 2018 +0800):
dc20c53c sss
to 192.168.11.10:9999 (y/N)? y
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
-------------------------------------------------------
参考http://www.itguai.com/git/a6049094.html,
增加git config --global review.192.168.11.10:9999.username gerrit1,再次上传成功。