gerrit/Documentation/cmd-create-project.txt
Shawn O. Pearce 897d9218ac Make administrator, create-project a global capability
This gets rid of the special entries in system_config and
gerrit.config related to who the Administrators group is,
or which groups are permitted to create new projects on
this server.

An interesting side effect of this change is admins can
now actually remove the blessed Administrators group and
run the server entirely without it. Fine grained rules
can be used for most permissions, and direct access to
the All-Projects.git repository can be used for cases
where the "Administrate Site" override power is needed.

Another benefit is the 'Create Project' capability is
now dynamic, and can be modified at runtime without a
server restart.

Bug: issue 742
Change-Id: I44702010a4a521fd67d986d5b20411002c9481dd
2011-06-16 17:00:06 -07:00

177 lines
5.0 KiB
Plaintext

gerrit create-project
=====================
NAME
----
gerrit create-project - Create a new hosted project
SYNOPSIS
--------
[verse]
'ssh' -p <port> <host> 'gerrit create-project'
[--owner <GROUP> ... | -o <GROUP> ...]
[--parent <NAME> | -p <NAME> ]
[--permissions-only]
[--description <DESC> | -d <DESC>]
[--submit-type <TYPE> | -t <TYPE>]
[--use-contributor-agreements | --ca]
[--use-signed-off-by | --so]
[--use-content-merge]
[--require-change-id | --id]
[--branch <REF> | -b <REF>]
[--empty-commit]
{ <NAME> | --name <NAME> }
DESCRIPTION
-----------
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.
ACCESS
------
Caller must be a member of the privileged 'Administrators' group,
or have been granted the 'Create Project' global capability.
SCRIPTING
---------
This command is intended to be used in scripts.
OPTIONS
-------
<NAME>::
Required; name of the new project to create. If name ends
with `.git` the suffix will be automatically removed.
--name::
-n::
Deprecated alias for the <NAME> argument. This option may
be removed in a future release.
--branch::
-b::
Name of the initial branch in the newly created project.
Defaults to 'master'.
--owner::
-o::
Name of the group(s) which will initially own this repository.
The specified group(s) must already be defined within Gerrit.
Several groups can be specified on the command line.
+
Defaults to what is specified by `repository.*.ownerGroup`
in gerrit.config.
--parent::
-p::
Name of the parent project to inherit access rights
through. If not specified, the parent is set to the default
project `All-Projects`.
--permissions-only::
Create the project only to serve as a parent for other
projects. The new project's Git repository will be
initialized to have 'HEAD' point to 'refs/meta/config'.
--description::
-d::
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'"`.
--submit-type::
-t::
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
link:project-setup.html#submit_type[Change Submit Actions].
--use-content-merge::
If enabled, Gerrit will try to perform a 3-way merge of text
file content when a file has been modified by both the
destination branch and the change being submitted. This
option only takes effect if submit type is not
FAST_FORWARD_ONLY. Disabled by default.
--use-contributor-agreements::
--ca::
If enabled, authors must complete a contributor agreement
on the site before pushing any commits or changes to this
project. Disabled by default.
--use-signed-off-by::
--so:
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.
--require-change-id::
--id::
Require a valid link:user-changeid.html[Change-Id] footer
in any commit uploaded for review. This does not apply to
commits pushed directly to a branch or tag.
--empty-commit::
Creates an initial empty commit for the Git repository of the
project that is newly created.
EXAMPLES
--------
Create a new project called `tools/gerrit`:
====
$ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git
====
Create a new project with a description:
====
$ ssh -p 29418 review.example.com gerrit create-project 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.
REPLICATION
-----------
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.
SEE ALSO
--------
* link:config-replication.html[Git Replication/Mirroring]
* link:project-setup.html[Project Setup]
GERRIT
------
Part of link:index.html[Gerrit Code Review]