在提交代码review的时候可能会出现
Could not connect to gerrit.
Enter your gerrit username: xxxx
Trying again with ssh://xxxx@review.openstack.org:29418/openstack/oslo.messaging.git
<traceback object at 0xb6fe493c>
We don't know where your gerrit is. Please manually create a remote
named "gerrit" and try again.
Traceback (most recent call last):
File "/usr/bin/git-review", line 1196, in <module>
main()
File "/usr/bin/git-review", line 1110, in main
config['hostname'], config['port'], config['project'])
File "/usr/bin/git-review", line 489, in check_remote
add_remote(hostname, port, project, remote)
File "/usr/bin/git-review", line 344, in add_remote
raise Exception("Could not connect to gerrit at %s" % remote_url)
Exception: Could not connect to gerrit at ssh://xxxx@review.openstack.org:29418/openstack/oslo.messaging.git
could not review.openstack.org
手动添加节点gerrit节点
git remote add gerrit ssh://<username>@review.openstack.org:29418/openstack/nova.git
someone@someone-ThinkPad-E420:~/oslo.messaging$ git review
Problem running 'git remote update gerrit'
正在获取 gerrit
ssh: Could not resolve hostname review.openstack.org: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: 不能获取 gerrit
Problems encountered installing commit-msg hook
The following command failed with exit code 1
"scp :hooks/commit-msg .git/hooks/commit-msg"
-----------------------
.git/hooks/commit-msg: No such file or directory
ssh -vv -p 29418 name@review.openstack.org
打印调试信息
....
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/someone/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/someone/.ssh/id_dsa
debug1: Trying private key: /home/someone/.ssh/id_ecdsa
debug1: Trying private key: /home/someone/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
删除.ssh目录,重新生成私密钥
由于在国内OpenStack社区gerrit的29418端口被墙,所以大家可以使用https/http来完成git reiview。
首先,需要登录review.openstack.org,然后在Settings -> HTTP Password里,生成一个HTTP密码,应该是一个大小写加数字的随机字符串。
然后通过
git remote set-url gerrit https://username:http-password@review.openstack.org/openstack/nova.git
命令把ssh修改成https方式,当然也可以用http,经过我的实验都是可以的。别忘了把上面字符串中的用户名/密码改成你的gerrit用户名和上一步生成的HTTP密码。
引用至http://blog.csdn.net/agileclipse/article/details/38980419