repo+gerrit环境搭建

搭建repo的过程中,遇到几个拦路虎,折腾了很久,终于搞定。

1.repo的main.py等脚本必须添加,否则提示错误。

脚本是从自此从内网拷贝来的。来源稍后需要再分析。

2.git 可以pull下来,repo sync 不下来

没有权限。

原因:.gitconfig确认用户名和邮箱是否和gerrit网页配置的一致。git并不会严格检查这里,所以git并没有问题。

3.repo upload没有权限。

repo --trace upload
: unpickle /home/gerrit3/git/repotest/.repo/manifests.git/config
: unpickle /home/gerrit3/.gitconfig
: load refs /home/gerrit3/git/repotest/.repo/projects/xiongyftest.git
: unpickle /home/gerrit3/git/repotest/.repo/projects/xiongyftest.git/config
: export GIT_DIR=/home/gerrit3/git/repotest/.repo/projects/xiongyftest.git
: git rev-list --abbrev=8 --abbrev-commit --pretty=oneline --reverse --date-order ^refs/remotes/origin/master refs/heads/feng -- 1>| 2>|
: git log --pretty=format:%cd -n 1 refs/heads/feng -- 1>| 2>|
Upload project xiongyftest/ to remote branch master:
  branch feng ( 3 commits, Thu May 10 19:40:43 2018 +0800):
         b35934e9 feg
         7e338c38 haha
         24c295d2 heall
to http://127.0.0.1:8091/ (y/N)? y


: cd /home/gerrit3/git/repotest/xiongyftest
: git update-index -q --unmerged --ignore-missing --refresh 1>| 2>|
: git diff-index -z --cached HEAD 1>| 2>|
: git diff-files -z 1>| 2>|
: git ls-files -z --others --exclude-standard 1>| 2>|
: git var GIT_COMMITTER_IDENT 1>| 2>|


: cd /home/gerrit3/git/repotest/.repo/repo
: git describe HEAD 1>|
fatal: 没有发现名称,无法描述任何东西。
: git --version 1>|
shitrinima

hello world http://127.0.0.1:8091/
: git push --receive-pack=gerrit receive-pack ssh://[email protected]:29418/xiongyftest refs/heads/feng:refs/for/master
Permission denied (publickey).
fatal: Could not read from remote repository.


Please make sure you have the correct access rights
and the repository exists.

原因:.gitconfig必须为repo单独添加用户名,可以见.repo/repo/git_config.py对用户名的解析。当gerrit review.url.username指明了,则使用gitconfig的。如果没有,则使用@邮箱名前的用户名。

[review "http://127.0.0.1:8091/"]

        username = admin

你可能感兴趣的:(repo+gerrit环境搭建)