Gerrit的使用和常见错误

邮件不符合错误

remote: ERROR:  You have not registered any email addresses.  
由于我的gerrit是内网,并且也没有内部邮件服务。

下面直接修改mysql中的数据来修复这个错误:

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| reviewdb           |
| test               |
+--------------------+
3 rows in set (0.02 sec)

mysql> use reviewdb

修改内容

mysql> show tables;
+------------------------------+
| Tables_in_reviewdb           |
+------------------------------+
| account_diff_preferences     |
| account_external_ids         |
| account_group_id             |
| account_group_includes       |
| account_group_includes_audit |
| account_group_members        |
| account_group_members_audit  |
| account_group_names          |
| account_groups               |
| account_id                   |
| account_patch_reviews        |
| account_project_watches      |
| account_ssh_keys             |
| accounts                     |
| approval_categories          |
| approval_category_values     |
| change_id                    |
| change_message_id            |
| change_messages              |
| changes                      |
| patch_comments               |
| patch_set_ancestors          |
| patch_set_approvals          |
| patch_sets                   |
| schema_version               |
| starred_changes              |
| submodule_subscriptions      |
| system_config                |
| tracking_ids                 |
+------------------------------+
29 rows in set (0.00 sec)

mysql> select * from account_external_ids ;  
+------------+---------------+----------+-----------------+
| account_id | email_address | password | external_id     |
+------------+---------------+----------+-----------------+
|          1 | NULL          | NULL     | gerrit:admin    |
|          2 | NULL          | NULL     | gerrit:chensy   |
|          1 | NULL          | NULL     | username:admin  |
|          2 | NULL          | NULL     | username:chensy |
+------------+---------------+----------+-----------------+
8 rows in set (0.02 sec)

mysql> update account_external_ids set email_address='[email protected]' where account_id=2;
Query OK, 2 rows affected (0.06 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from account_external_ids ;  
+------------+-----------------+----------+-----------------+
| account_id | email_address   | password | external_id     |
+------------+-----------------+----------+-----------------+
|          1 | NULL            | NULL     | gerrit:admin    |
|          2 | [email protected] | NULL     | gerrit:chensy   |
|          1 | NULL            | NULL     | username:admin  |
|          2 | [email protected] | NULL     | username:chensy |
+------------+-----------------+----------+-----------------+
8 rows in set (0.00 sec)

mysql> \q
Bye
git@pm:/root$ bin/gerrit.sh restart
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: OK

没有权限编辑仓库错误

由于我是直接把原来的git仓库拷贝到gerrit的git目录中的,所以这些仓库并不能直接使用。

You don't have permissions to modify the access rights for the following refs:
refs/heads/*
You may propose these modifications to the project owners by clicking on 'Save for Review'.
解决方法就是:在浏览器中进入gerrit页面,新建个项目即可(以原始的git项目为父项目)。

那样就可以修改项目权限了,也能直接push了(对新仓库push前先建立branch)。

gerrit中中文显示乱码

这个乱码有2个地方,

用户名显示问号

Full Name	???

这个问题的解决见参考【3】。

修改mysql的连接:

       [database]
        type = mysql
        hostname = localhost
        database = reviewdb
        username = user
改为:

       [database]
        type = mysql
        url = jdbc:mysql://localhost:3306/reviewdb?user=user&password=pwd&useUnicode=true&characterEncoding=utf8


Git log显示问号

git的log全部显示为乱码,在其它地方又显示正常。


参考

【1】构建自己的Android代码托管服务器 【推荐】
http://blog.csdn.net/billpig/article/details/7604828

【2】apache2 + git + gerrit + mysql 配置、简单git操作

【3】gerrit使用mysql数据库及中文提交-2【推荐】

http://zeze0556.dyndns.info/2013/07/11/gerrit%E4%BD%BF%E7%94%A8mysql%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8F%8A%E4%B8%AD%E6%96%87%E6%8F%90%E4%BA%A4-2/

【4】Git、Gerrit与Jenkins/Hudson CI服务器
http://www.infoq.com/cn/articles/Gerrit-jenkins-hudson

你可能感兴趣的:(Linux)