gerrit create-project - Create a new hosted project


ssh -p <port> <host> gerrit create-project --name <NAME> [—branch <REF>] [--owner <GROUP>] [--description <DESC>] [--submit-type <TYPE>] [--use-contributor-agreements] [--use-signed-off-by]


Creates a new bare Git repository under gerrit.basePath, using the project name supplied. The newly created repository is empty (has no commits), but is registered in the Gerrit database so that the initial commit may be uploaded for review, or initial content can be pushed directly into a branch.

If replication is enabled, this command also connects to each of the configured remote systems over SSH and uses command line git on the remote system to create the empty repository.


Caller must be a member of the privileged Administrators group.


This command is intended to be used in scripts.



Required; name of the project to create. If name ends with .git the suffix will be automatically removed.


Name of the initial branch in the newly created project. Defaults to master.


Name of the group which will initially own this repository. The specified group must already be defined within Gerrit. Only one group can be specified on the command line. To specify additional owners, add the additional owners through the web interface after project creation.

Defaults to Administrators if not specified.


Initial description of the project. If not specified, no description is stored.

Description values containing spaces should be quoted in single quotes ('). This most likely requires double quoting the value, for example --description "'A description string'".


Action used by Gerrit to submit an approved change to its destination branch. Supported options are:

  • FAST_FORWARD_ONLY: produces a strictly linear history.

  • MERGE_IF_NECESSARY: create a merge commit when required.

  • MERGE_ALWAYS: always create a merge commit.

  • CHERRY_PICK: always cherry-pick the commit.

Defaults to MERGE_IF_NECESSARY. For more details see Change Submit Actions.


If enabled, authors must complete a contributor agreement on the site before pushing any commits or changes to this project. Disabled by default.


If enabled, each change must contain a Signed-off-by line from either the author or the uploader in the commit message. Disabled by default.


Create a new project called tools/gerrit:

$ ssh -p 29418 gerrit create-project --name tools/gerrit.git

Create a new project with a description:

$ ssh -p 29418 gerrit create-project --name tool.git --description "'Tools used by build system'"

Note that it is necessary to quote the description twice. The local shell needs double quotes around the value to ensure the single quotes are passed through SSH as-is to the remote Gerrit server, which uses the single quotes to delimit the value.


The remote repository creation is performed by a Bourne shell script:

mkdir -p '/base/project.git' && cd '/base/project.git' && git init --bare && git update-ref HEAD refs/heads/master

For this to work successfully the remote system must be able to run arbitrary shell scripts, and must have git in the user's PATH environment variable. Administrators could also run this command line by hand to establish a new empty repository.


Part of Gerrit Code Review