Android上传代码时用到gerrit服务器,记录下如何搭建
具体的搭建过程可参考 https://blog.csdn.net/twilightdream/article/details/72953282
gerrit下载网站 https://gerrit-releases.storage.googleapis.com/index.html(不要安装gerrit-2.12.4.war,注册邮箱时会报错)
电脑的用户要跟gerrit设置的用户一致
每个用户登录用要上传ssh公钥(终端运行ssh-keygen,公钥路径~/.ssh/id_rsa.pub点击右上角,设置,SSH Public Keys),
可以用如下命令测试连通性
ssh [email protected] -p 29418
ssh -p 29418 [email protected] gerrit create-project --empty-commit project_name
git push origin master:refs/for/master
报错
Unable to negotiate with 192.168.1.101 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
打开~/.ssh/config
Host *
KexAlgorithms +diffie-hellman-group1-sha1
具体的搭建过程可参考 https://blog.csdn.net/twilightdream/article/details/72953282
gerrit下载网站 https://gerrit-releases.storage.googleapis.com/index.html(不要安装gerrit-2.12.4.war,注册邮箱时会报错)
repo工具下载git clone https://review.mfunz.com/git-repo(将REPO_URL改成git-repo所在的路径),并让repo能在终端直接调用sudo cp repo /etc/bin/
[auth] type = HTTP发邮件地址设置
[sendemail] smtpServer = smtp.163.com smtpServerPort = 465 smtpEncryption = ssl smtpUser = [email protected] smtpPass = xxxxxxxxxxxx sslVerify = false from=CodeReview<[email protected]>
这个邮箱负责给登录的用户发邮件,验证登录客户的邮件信息。
开启gerrit ./gerrit.sh start
停止gerrit ./gerrit.sh stop
gerrit出错信息保存路径 gerrit安装路径logs/error_log,最后的出错信息在文件结尾
第一个登录的用户就是管理员,每个用户第一次登录都要设置邮箱。电脑的用户要跟gerrit设置的用户一致
每个用户登录用要上传ssh公钥(终端运行ssh-keygen,公钥路径~/.ssh/id_rsa.pub点击右上角,设置,SSH Public Keys),
可以用如下命令测试连通性
ssh [email protected] -p 29418
root@HD:/home/w# ssh [email protected] -p 29418 **** Welcome to Gerrit Code Review **** Hi admin, you have successfully connected over SSH. Unfortunately, interactive shells are disabled. To clone a hosted Git repository, use: git clone ssh://admin@HD:29418/REPOSITORY_NAME.git创建工程
ssh -p 29418 [email protected] gerrit create-project --empty-commit project_name
ssh -p 29418 [email protected] gerrit create-project project_name(可用来推送已有的git工程)
删除工程 先安装插件(https://www.gaott.info/gerrit-delete-project/),然后
ssh -p 29418 [email protected] deleteproject delete --yes-really-delete --force xxxx
git push origin master:refs/for/master
报错
Unable to negotiate with 192.168.1.101 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
打开~/.ssh/config
Host *
KexAlgorithms +diffie-hellman-group1-sha1