1. 添加公钥认证
那请登录 gerrit 网页
http://172.16.*.*:8080/#/settings/ssh-keys
添加本地公钥内容到gerrit
2. vi ~/.ssh/config
Host gerrit
Hostname 172.16.*.*
Port 29418
User yourname ###gerrit登录名一致
3. ssh gerrit
会有如下提示:
~$ ssh gerrit
**** Welcome to Gerrit Code Review ****
Hi yourname, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use:
git clone ssh://[email protected]*.*:29418/REPOSITORY_NAME.git
如果提示输入git密码,则需要重新生成公私钥对,重新添加公钥到gerrit
4. 提交到gerrit
git push gerrit:repertory HEAD:refs/for/branchname
注:git config --list 用户名和邮箱一定要和gerrit 设置完全一致,否则提交有问题会
时间: 2024-11-10 10:15:05