Client

Client commands and hooks can be downloaded via scp, wget or curl from Gerrit’s daemon, and then executed on the client system.

To download a client command or hook, use scp or an http client:

$ scp -p -P 29418 john.doe@review.example.com:bin/gerrit-cherry-pick ~/bin/
$ scp -p -P 29418 john.doe@review.example.com:hooks/commit-msg .git/hooks/

$ curl -Lo ~/bin/gerrit-cherry-pick http://review.example.com/tools/bin/gerrit-cherry-pick
$ curl -Lo .git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg

For more details on how to determine the correct SSH port number, see Testing Your SSH Connection.

Commands

gerrit-cherry-pick

Download and cherry-pick one or more changes (commits).

Hooks

Client hooks can be installed into a local Git repository, improving the developer experience when working with a Gerrit Code Review server.

commit-msg

Automatically generate Change-Id: tags in commit messages.

Server

Aside from the standard Git server side actions, Gerrit supports several other commands over its internal SSH daemon. As Gerrit does not provide an interactive shell, the commands must be triggered from an ssh client, for example:

  $ ssh -p 29418 review.example.com gerrit ls-projects

For more details on how to determine the correct SSH port number, see Testing Your SSH Connection.

User Commands

gerrit apropos

Search Gerrit documentation index.

gerrit ban-commit

Bans a commit from a project’s repository.

gerrit create-branch

Create a new project branch.

gerrit ls-groups

List groups visible to the caller.

gerrit ls-members

List the membership of a group visible to the caller.

gerrit ls-projects

List projects visible to the caller.

gerrit query

Query the change search index.

'gerrit receive-pack'

'Deprecated alias for git receive-pack.'

gerrit rename-group

Rename an account group.

gerrit review

Verify, approve and/or submit a patch set from the command line.

gerrit set-head

Change the HEAD reference of a project.

gerrit set-project

Change a project’s settings.

gerrit set-project-parent

Change the project permissions are inherited from.

gerrit set-reviewers

Add or remove reviewers on a change.

gerrit stream-events

Monitor events occurring in real time.

gerrit version

Show the currently executing version of Gerrit.

git receive-pack

Standard Git server side command for client side git push.

Also implements the magic associated with uploading commits for review. See Creating Changes.

git upload-pack

Standard Git server side command for client side git fetch.

Administrator Commands

gerrit close-connection

Close the specified SSH connection.

gerrit create-account

Create a new user account.

gerrit create-group

Create a new account group.

gerrit create-project

Create a new project and associated Git repository.

gerrit flush-caches

Flush some/all server caches from memory.

gerrit gc

Run the Git garbage collection.

gerrit index activate

Activate the latest index version available.

gerrit index start

Start the online indexer.

gerrit index changes

Index one or more changes.

gerrit index changes-in-project

Index all the changes in one or more projects.

gerrit logging ls-level

List loggers and their logging level.

gerrit logging set-level

Set the logging level of loggers.

gerrit ls-user-refs

Lists refs visible for a specified user.

gerrit plugin add

Alias for 'gerrit plugin install'.

gerrit plugin enable

Enable plugins.

gerrit plugin install

Install/Add a plugin.

gerrit plugin ls

List the installed plugins.

gerrit plugin reload

Reload/Restart plugins.

gerrit plugin remove

Disable plugins.

gerrit plugin rm

Alias for 'gerrit plugin remove'.

gerrit reload-config

Apply an updated gerrit.config.

gerrit set-account

Change an account’s settings.

gerrit sequence show

Display current sequence value.

gerrit set-members

Set group members.

gerrit show-caches

Display current cache statistics.

gerrit show-connections

Display active client SSH connections.

gerrit show-queue

Display the background work queues, including replication.

gerrit test-submit rule

Test prolog submit rules.

gerrit test-submit type

Test prolog submit type.

kill

Kills a scheduled or running task.

ps

Alias for 'gerrit show-queue'.

suexec

Execute a command as any registered user account.

Trace

For executing SSH commands tracing can be enabled by setting the --trace and --trace-id <trace-id> options. It is recommended to use the ID of the issue that is being investigated as trace ID.

  $ ssh -p 29418 review.example.com gerrit create-project --trace --trace-id issue/123 foo/bar

It is also possible to omit the trace ID and get a unique trace ID generated.

  $ ssh -p 29418 review.example.com gerrit create-project --trace foo/bar

Enabling tracing results in additional logs with debug information that are written to the error_log. All logs that correspond to the traced request are associated with the trace ID. The trace ID is printed to the stderr command output:

  TRACE_ID: 1534174322774-7edf2a7b

Given the trace ID an administrator can find the corresponding logs and investigate issues more easily.