admin管理员组

文章数量:1648401

使用Gerrit set-account命令可以对Gerrit用户进行配置、查询信息等操作

帮助命令:ssh -p 29418 user@192.168.1.1 gerrit set-account --help

gerrit set-account USER [--] [--active] [--add-email EMAIL] [--add-ssh-key -|KEY] [--clear-http-password] [--delete-email EMAIL] [--delete-ssh-key -|KEY] [--full-name NAME] [--generate-http-password] [--help (-h)] [--http-password PASSWORD] [--inactive] [--preferred-email EMAIL] [--trace] [--trace-id VAL]

 USER                     : full name, email-address, ssh username or account id
 --                       : end of options (default: false)
 --active                 : set account's state to active (default: false)
 --add-email EMAIL        : email addresses to add to the account
 --add-ssh-key -|KEY      : public keys to add to the account
 --clear-http-password    : clear HTTP password for the account (default: false)
 --delete-email EMAIL     : email addresses to delete from the account
 --delete-ssh-key -|KEY   : public keys to delete from the account
 --full-name NAME         : display name of the account
 --generate-http-password : generate a new HTTP password for the account
                            (default: false)
 --help (-h)              : display this help text (default: true)
 --http-password PASSWORD : password for HTTP authentication for the account
 --inactive               : set account's state to inactive (default: false)
 --preferred-email EMAIL  : a registered email address from the account
 --trace                  : enable request tracing (default: false)
 --trace-id VAL           : trace ID (can only be set if --trace was set too)

生成用户http密码:

ssh -p 29418 user@192.168.1.1 gerrit set-account user --generate-http-password

添加public key:

cat ~/.ssh/id_rsa.pub | ssh -p 29418 gerrit_address gerrit set-account --add-ssh-key - jenkins

测试连接:

ssh -p 29418 10.211.211.211

配置账号:

Host 10.2.2.2
    HostName 10.2.2.2
    User jenkins
    IdentityFile ~/.ssh/id_rsa
    HostkeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa

删除Gerrit用户:

删除Gerrit用户
git clone /srv/gerrit/git/All-Users.git
cd All-Users
git fetch origin refs/meta/external-ids:refs/remotes/origin/meta/external-ids
git checkout FETCH_HEAD
git push origin HEAD:refs/meta/external-ids
ssh -p 29418 user@gerrit_IP gerrit flush-caches --all

本文标签: GerritsetAccount