[英]Http connection unauthorized in gerrit trigger
I am trying to setup Rest API for gerrit trigger jenkins plugin. 我正在尝试为Gerrit触发器jenkins插件设置Rest API。 I have created a service user in git.
我已经在git中创建了一个服务用户。
But now when i am entering the http username/password for service user and pressing test connection . 但是现在当我为服务用户输入http用户名/密码并按test connection时。 I am getting Http connection unauthorized connection.
我正在获得Http连接未授权的连接。
HTTP password is nothing but the SSH public key added in the gerrit config UI. HTTP密码不过是在gerrit配置UI中添加的SSH公钥。
Best Regards, Saurav 最好的问候,索拉夫
I was facing similar problem and then I found the solution here: https://dev.vaadin.com/review/Documentation/dev-rest-api.html#_authentication 我遇到了类似的问题,然后在这里找到了解决方案: https : //dev.vaadin.com/review/Documentation/dev-rest-api.html#_authentication
The gerrituser and httppassword should be used from http://gerrit-url/#/settings/http-password link. gerrituser和httppassword应该通过http:// gerrit-url /#/ settings / http-password链接使用。 You can test that with .netrc file as well.
您也可以使用.netrc文件进行测试。
I don't know how your gerrit was configured so I suggest you should also try to switch from basic_auth to digest_auth. 我不知道您的Gerrit是如何配置的,因此我建议您也应尝试从basic_auth切换到digest_auth。 eg:
例如:
curl -X GET --digest -u gerrituser:httppassword http://gerrit-url/a/path/to/api
curl -X POST --digest -u gerrituser:httppassword -d '{json data}' http://gerrit-url/a/path/to/api
Try something like this: 尝试这样的事情:
Copy repository using http (command below) 使用http复制存储库(以下命令)
git clone http://gerrituser:httppassword@gerrit_url/p/nameofproject.git git clone http:// gerrituser:httppassword@gerrit_url/p/nameofproject.git
If you want use JSON file try this example command,create file body.json: 如果要使用JSON文件,请尝试以下示例命令,创建文件body.json:
curl -H "Content-Type: application/json" -X POST --data @body.json http://gerrituser:httppassword@gerrit_url/a/changes/Change_Id/revisions/commit/review curl -H“内容类型:应用程序/ json” -X POST --data @ body.json http:// gerrituser:httppassword @ gerrit_url / a / changes / Change_Id / revisions / commit / review
JSON files and rest command of Gerrit REST API you can find here: https://gerrit-review.googlesource.com/Documentation/rest-api.html 您可以在以下位置找到Gerrit REST API的JSON文件和rest命令: https : //gerrit-review.googlesource.com/Documentation/rest-api.html
ps. PS。 the letters /a/ and /p/ are necessary, remember of user permission and HTTP password should be without slash.
字母/ a /和/ p /是必需的,请记住用户权限,并且HTTP密码不应带有斜杠。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.