Gerrit(1): Manage Projects

1) Register an openid account

2) Custom settings

  • set SSH pubkey
  • set username and email
  • other

3) Update the IP address of remote repositories

  • git clone ssh://user_Name@gerrit_Server:SSH_Port/repo_Name.git    # 必须拥该 gerrit 远程库的 Read 权限

4) Push code

  • git push origin HEAD:refs/for/branch_Name    # 必须有 Push 权限

5) Autogenerate Chang-Id

  • scp -p -P SSH_Port gerritRoot@gerrit_Server:hooks/commit-msg .git/hooks/
  • chmod u+x .git/hooks/commit-msg

6) Watch projects

7) Review code

8) Privilege and User management

  • gerrit 以用户组为基本单位划分权限

9) Local documents

10) SSH Ops

  • # Connect To Gerrit Server
    • ssh -p SSH_Port gerritRoot@gerrit_Server 
  • #Create Branch By SSH 
    • ssh -p SSH_Port gerritRoot@gerrit_Server gerrit create-branch myproject newbranch master
  • # Get Command Help
    • ssh -p SSH_Port gerritRoot@gerrit_Server gerrit --help

11) Other

  • # Continue An Failed Commit
    • git commit --amend
  • #Push with bypassing Code Review
    • git commit
    • git push origin HEAD:refs/heads/master
  • #Import an existing history into a Gerrit project
    • # push it directly to refs/heads/<branch>     # 必须有 'Create References' 权限,通常由管理员执行
  • #Repo State
    • Active / Read Only / Hidden
原文地址:https://www.cnblogs.com/hadex/p/6802580.html