External troubleshooting resource

https://www.mediawiki.org/wiki/Gerrit/Troubleshooting

Cannot git clone code from server

Cloning into 'Firmware'... Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights

Solutions

  1. Please check whether you've add SSH public key into gerrit server.
  2. Please check whether your user name on the client host is same as that in domain. If not, please clone with domain name like this command,

git clone ssh://<user name>@gerrit.yuneec.com:29418/Firmware

Cannot push code into gerrit server case 1

$ git push origin HEAD:refs/for/master

对象计数中: 3, 完成.

Delta compression using up to 8 threads.

压缩对象中: 100% (2/2), 完成.

写入对象中: 100% (3/3), 287 bytes | 0 bytes/s, 完成.

Total 3 (delta 1), reused 0 (delta 0)

remote: Resolving deltas: 100% (1/1)

remote: Processing changes: refs: 1, done

remote: ERROR: [349beb9] missing Change-Id in commit message footer

remote:

remote: Hint: To automatically insert Change-Id, install the hook:

remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 [email protected]:hooks/commit-msg ${gitdir}/hooks/

remote: And then amend the commit:

remote: git commit --amend

remote:

To ssh://gerrit.yuneec.com:29418/Example

! [remote rejected] HEAD -> refs/for/master ([349beb9] missing Change-Id in commit message footer)

error: 无法推送一些引用到 'ssh://[email protected]:29418/Example'

Root cause: Gerrit uses .git/hook/commit-msg to generate unique change-Id for each commit, and use it to link with Gerrit URL. This push is failed because the hook file does not exist in local git, and the change-Id is not generated. Gerrit refuses to accept change without change-Id.

Solution: Get hook file from gerrit, amend local change to generate change-Id and push to gerrit again.

$gitdir=$(git rev-parse --git-dir); scp -p -P 29418 <user name>@gerrit.yuneec.com:hooks/commit-msg ${gitdir}/hooks/

$git commit --amend

$git push origin HEAD:refs/for/master

Cannot push code into gerrit server case 2

$git push origin HEAD:refs/heads/master

对象计数中: 1355, 完成.

Delta compression using up to 8 threads.

压缩对象中: 100% (1342/1342), 完成.

写入对象中: 100% (1355/1355), 251.84 MiB | 3.78 MiB/s, 完成.

Total 1355 (delta 277), reused 0 (delta 0)

remote: Resolving deltas: 100% (277/277)

remote: Processing changes: refs: 1, done

To ssh://gerrit.yuneec.com:29418/document.git

! [remote rejected] HEAD -> master (prohibited by Gerrit: create access denied for refs/heads/master)

error: 无法推送一些引用到 'ssh://[email protected]:29418/Example.git'

Root cause: Push code into git repository directly without Gerrit review is forbidden.

Solution: Push code into Gerrit review, and merge it in Gerrit.

$git push origin HEAD:refs/for/master

Cannot push code into gerrit server case 3

Root cause: Your local git config is using another email address. Please check local CL by "git log"

Solution: Use "git config --global user.email=<xxx>" to configure correct email address, and clean local CL with incorrect email address. After this, please run this command to update your commit author.

$git commit --amend --reset-author

After this, please push the commit to Gerrit again.

Cannot login into gerrit

Please stop retry and contact with Gerrit admin [email protected], [email protected] for support.


For administrator: It looks there is bug in Gerrit to add database records, when creating a new user account.

For each user, there is one record in table accounts, and two records in table account_external_ids. When problem happens, there is only one record in table account_external_ids. To fix the problem, we have to delete the account and let user login gerrit again.

  • Backup mysql db
 $mysqldump -uroot -p123456 reviewdb &gt; ~/reviewdb.sql
  • Delete user from all groups in gerrit website

  • Stop gerrit

  • Delete accounts from mysql

$mysql -uroot -p

mysql>user reviewdb;

mysql>delete from accounts where account_id=20;

mysql>delete from account_external_ids where account_id=20;

  • Restart gerrit

  • Let user login gerrit from website again. The login should be successful.

After this, we should see two records in table account_external_ids.

results matching ""

    No results matching ""