Gerrit 笔记

Gerrit 通过git push后增加一个中间状态, 来完成代码审批环节, 因此在git commit的时候增加了一个change id, 并且push到定制的target, 在push之后, 需要审批通过后再fetch, 将状态同步后, 才能继续push.

使用中Git相关的一些操作

1. 本地创建密钥对, 将公钥配置到Gerrit后台的用户配置下

2. Git clone之后, 需要将 commit-msg 这个hook文件放到项目的.git/hooks/ 目录下, 如果是linux系统, 需要确认这个文件是可执行的(u+x)

3. 修改target, 在项目目录下执行

git config --local remote.origin.push refs/heads/*:refs/for/*

4. 对于高版本git, 会遇到 fatal: ssh variant 'simple' does not support setting port 这样的错误, 需要在项目目录下执行

git config --local ssh.variant ssh

5. 如果 git clone 时出现以下错误,需要修改 ~/.ssh/config 增加配置

Unable to negotiate with 192.168.31.10 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
fatal: Could not read from remote repository.

Host 192.168.123.123
    IdentityFile ~/.ssh/id_rsa_123.123
    KexAlgorithms +diffie-hellman-group1-sha1
    User yourname
原文地址:https://www.cnblogs.com/milton/p/12576792.html