Gerrit—一些操作

1、删除库

# 删除项目需要登录到服务器上去操作
ssh -p 29418 root@localhost delete-project delete --yes-really-delete xxxxx-content-market
ssh -p 29418 root@localhost gerrit flush-caches --cache projects


2、删除带空格的项目
ssh -p 29418 root@localhost delete-project delete --yes-really-delete '\ xxxxx-device-center.git'


ssh -p 29418 root@localhost delete-project delete --yes-really-delete 'xxxxx.git'


ssh -p 29418 root@localhost delete-project delete --yes-really-delete 'xxxxx.git'

ssh -p 29418 root@localhost delete-project delete --yes-really-delete 'xxxxx-client'
ssh -p 29418 root@localhost delete-project delete --yes-really-delete 'xxxxx-parent'	
ssh -p 29418 root@localhost delete-project delete --yes-really-delete 'xxxxx-plugins' 	

2、错误【git missing Change-Id in commit message footer】的解决

To ssh://gerrit.baidu.com:29418/starfire-server
! [remote rejected] HEAD -> refs/for/master (commit 961af76: missing Change-Id in message footer)
error: failed to push some refs to ‘ssh://gerrit.baidu.com:29418/starfire-server’

gitdir=$(git rev-parse --git-dir)
scp -O -P 29418 lyqiao@gerrit.baidu.com:hooks/commit-msg ${gitdir}/hooks/
git commit --amend --no-edit
git push origin HEAD:refs/for/master

3、错误【email address you@example.com is not registered】

remote: ERROR: commit 827add8: email address you@example.com is not registered in your account, and you lack

git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "MY_NAME@example.com"

上面设置的user.email的值,一定要与用户激活时用到的邮件是相同的。

解决

4、拉取代码并提交

git clone "ssh://qinhao@gerrit.aolingo.com:29418/AnlingoAndroid"&& (cd "AnlingoAndroid" && mkdir -p `git rev-parse --git-dir`/hooks/ && scp -O -p -P 29418 qinhao@gerrit.aolingo.com:hooks/commit-msg `git rev-parse --git-dir`/hooks/ && chmod +x `git rev-parse --git-dir`/hooks/commit-msg)