blob: 9d2b98b6ef844a09a8c1df2c2156e18994e2f839 [file] [log] [blame]
Shawn O. Pearce6e752212009-08-12 12:22:12 -07001gerrit create-project
2=====================
3
4NAME
5----
6gerrit create-project - Create a new hosted project
7
8SYNOPSIS
9--------
10[verse]
Shawn O. Pearce47769242011-06-14 16:40:48 -070011'ssh' -p <port> <host> 'gerrit create-project'
12 [--owner <GROUP> ... | -o <GROUP> ...]
13 [--parent <NAME> | -p <NAME> ]
14 [--permissions-only]
15 [--description <DESC> | -d <DESC>]
16 [--submit-type <TYPE> | -t <TYPE>]
17 [--use-contributor-agreements | --ca]
18 [--use-signed-off-by | --so]
19 [--use-content-merge]
20 [--require-change-id | --id]
21 [--branch <REF> | -b <REF>]
22 [--empty-commit]
23 { <NAME> | --name <NAME> }
Shawn O. Pearce6e752212009-08-12 12:22:12 -070024
25DESCRIPTION
26-----------
27Creates a new bare Git repository under `gerrit.basePath`, using
28the project name supplied. The newly created repository is empty
29(has no commits), but is registered in the Gerrit database so that
30the initial commit may be uploaded for review, or initial content
31can be pushed directly into a branch.
32
33If replication is enabled, this command also connects to each of
34the configured remote systems over SSH and uses command line git
35on the remote system to create the empty repository.
36
37
38ACCESS
39------
Shawn O. Pearce897d9212011-06-16 16:59:59 -070040Caller must be a member of the privileged 'Administrators' group,
41or have been granted the 'Create Project' global capability.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070042
43SCRIPTING
44---------
45This command is intended to be used in scripts.
46
47OPTIONS
48-------
Shawn O. Pearce47769242011-06-14 16:40:48 -070049<NAME>::
50 Required; name of the new project to create. If name ends
51 with `.git` the suffix will be automatically removed.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070052
Shawn O. Pearce47769242011-06-14 16:40:48 -070053--name::
54-n::
55 Deprecated alias for the <NAME> argument. This option may
56 be removed in a future release.
57
58--branch::
59-b::
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070060 Name of the initial branch in the newly created project.
61 Defaults to 'master'.
62
Shawn O. Pearce47769242011-06-14 16:40:48 -070063--owner::
64-o::
Hugo Josefson072b4702010-04-21 19:27:11 +020065 Name of the group(s) which will initially own this repository.
66 The specified group(s) must already be defined within Gerrit.
67 Several groups can be specified on the command line.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070068+
Shawn O. Pearce47769242011-06-14 16:40:48 -070069Defaults to what is specified by `repository.*.ownerGroup`
Shawn O. Pearce897d9212011-06-16 16:59:59 -070070in gerrit.config.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070071
Shawn O. Pearce47769242011-06-14 16:40:48 -070072--parent::
73-p::
Shawn O. Pearce9c151142010-04-23 17:03:16 -070074 Name of the parent project to inherit access rights
75 through. If not specified, the parent is set to the default
Shawn O. Pearcea0631822011-06-14 11:18:18 -070076 project `All-Projects`.
Shawn O. Pearce9c151142010-04-23 17:03:16 -070077
Shawn O. Pearce47769242011-06-14 16:40:48 -070078--permissions-only::
Shawn O. Pearceaaca9592011-06-14 10:24:49 -070079 Create the project only to serve as a parent for other
80 projects. The new project's Git repository will be
81 initialized to have 'HEAD' point to 'refs/meta/config'.
82
Shawn O. Pearce47769242011-06-14 16:40:48 -070083--description::
84-d::
Shawn O. Pearce6e752212009-08-12 12:22:12 -070085 Initial description of the project. If not specified,
86 no description is stored.
Shawn O. Pearceea6fc172009-09-18 15:40:38 -070087+
88Description values containing spaces should be quoted in single quotes
Shawn O. Pearce47769242011-06-14 16:40:48 -070089('). This most likely requires double quoting the value, for example
90`--description "'A description string'"`.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070091
Shawn O. Pearce47769242011-06-14 16:40:48 -070092--submit-type::
93-t::
Shawn O. Pearce6e752212009-08-12 12:22:12 -070094 Action used by Gerrit to submit an approved change to its
95 destination branch. Supported options are:
96+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070097* FAST_FORWARD_ONLY: produces a strictly linear history.
98* MERGE_IF_NECESSARY: create a merge commit when required.
99* MERGE_ALWAYS: always create a merge commit.
100* CHERRY_PICK: always cherry-pick the commit.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700101
102+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700103Defaults to MERGE_IF_NECESSARY. For more details see
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700104link:project-setup.html#submit_type[Change Submit Actions].
105
Shawn O. Pearce47769242011-06-14 16:40:48 -0700106--use-content-merge::
Dmitry Fink876953e2010-09-29 23:44:22 -0700107 If enabled, Gerrit will try to perform a 3-way merge of text
108 file content when a file has been modified by both the
109 destination branch and the change being submitted. This
110 option only takes effect if submit type is not
111 FAST_FORWARD_ONLY. Disabled by default.
112
Shawn O. Pearce47769242011-06-14 16:40:48 -0700113--use-contributor-agreements::
114--ca::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700115 If enabled, authors must complete a contributor agreement
116 on the site before pushing any commits or changes to this
117 project. Disabled by default.
118
Shawn O. Pearce47769242011-06-14 16:40:48 -0700119--use-signed-off-by::
120--so:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700121 If enabled, each change must contain a Signed-off-by line
122 from either the author or the uploader in the commit message.
123 Disabled by default.
124
Shawn O. Pearce47769242011-06-14 16:40:48 -0700125--require-change-id::
126--id::
127 Require a valid link:user-changeid.html[Change-Id] footer
128 in any commit uploaded for review. This does not apply to
129 commits pushed directly to a branch or tag.
130
131--empty-commit::
Shawn Pearceec155112010-10-12 13:58:36 +0200132 Creates an initial empty commit for the Git repository of the
133 project that is newly created.
134
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700135
136EXAMPLES
137--------
138Create a new project called `tools/gerrit`:
139
140====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700141 $ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700142====
143
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700144Create a new project with a description:
145
146====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700147 $ ssh -p 29418 review.example.com gerrit create-project tool.git --description "'Tools used by build system'"
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700148====
149
150Note that it is necessary to quote the description twice. The local
151shell needs double quotes around the value to ensure the single quotes
152are passed through SSH as-is to the remote Gerrit server, which uses
153the single quotes to delimit the value.
154
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700155REPLICATION
156-----------
157The remote repository creation is performed by a Bourne shell script:
158
159====
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700160 mkdir -p '/base/project.git' && cd '/base/project.git' && git init --bare && git update-ref HEAD refs/heads/master
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700161====
162
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700163For this to work successfully the remote system must be able to run
164arbitrary shell scripts, and must have `git` in the user's PATH
165environment variable. Administrators could also run this command line
166by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700167
168SEE ALSO
169--------
170
171* link:config-replication.html[Git Replication/Mirroring]
172* link:project-setup.html[Project Setup]
173
174GERRIT
175------
176Part of link:index.html[Gerrit Code Review]