summaryrefslogtreecommitdiffstats
path: root/Documentation/cmd-create-project.txt
blob: 026d7b1f5a06e20b385bcfd6e2a8b7c86fd396f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
= 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> ]
  [--suggest-parents | -S ]
  [--permissions-only]
  [--description <DESC> | -d <DESC>]
  [--submit-type <TYPE> | -t <TYPE>]
  [--use-contributor-agreements | --ca]
  [--use-signed-off-by | --so]
  [--use-content-merge]
  [--create-new-change-for-all-not-in-target]
  [--require-change-id | --id]
  [[--branch <REF> | -b <REF>] ...]
  [--empty-commit]
  [--max-object-size-limit <N>]
  [--plugin-config <PARAM> ...]
  { <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
link:access-control.html#capability_createProject[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.

--branch::
-b::
	Name of the initial branch(es) in the newly created project.
	Several branches can be specified on the command line.
	If several branches are specified then the first one becomes HEAD
	of the project. If none branches are specified then default value
	('master') is used.

--owner::
-o::
	Identifier of the group(s) which will initially own this repository.
+
--
This can be:

* the UUID of the group
* the legacy numeric ID of the group
* the name of the group if it is unique
--
+
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`.

--suggest-parents::
-S::
	Suggest parent candidates. This option cannot be used with
	other arguments. Print out a list of projects that are
	already parents to other projects, thus it can help the user
	find a suitable parent for the new project.

--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.
* REBASE_IF_NECESSARY: rebase the commit when required.
* REBASE_ALWAYS: always rebase the commit including dependencies.
* MERGE_ALWAYS: always create a merge commit.
* CHERRY_PICK: always cherry-pick the commit.

+
Defaults to MERGE_IF_NECESSARY unless
link:config-gerrit.html#repository.name.defaultSubmitType[
repository.<name>.defaultSubmitType] is set to a different value.
For more details see link:project-configuration.html#submit_type[
Submit Types].

--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.

--create-new-change-for-all-not-in-target::
--ncfa:
	If enabled, a new change is created for every commit that is not in
	the target branch. If the pushed commit is a merge commit, this flag is
	ignored for that push. To avoid accidental creation of a large number
	of open changes, this option also does not accept merge commits in the
	commit chain.
	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.

--max-object-size-limit::
	Define maximum Git object size for this project. Pushes containing an
	object larger than this limit will be rejected. This can be used to
	further limit the global
  link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit]
	and cannot be used to increase that globally set limit.
+
Common unit suffixes of 'k', 'm', or 'g' are supported.

--plugin-config::
	A plugin configuration parameter that should be set for this
	project. The plugin configuration parameter must be specified in
	the format '<plugin-name>.<parameter-name>=<value>'. Only
	parameters that are explicitly declared by a plugin can be set.
	Multiple `--plugin-config` options can be specified to set multiple
	plugin parameters.


== 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
If the replication plugin is installed, the plugin will attempt to
perform remote repository creation 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.

A custom extension or plugin may also be developed to implement the
NewProjectCreatedListener extension point and handle custom logic
for remote repository creation.

== SEE ALSO

* link:project-configuration.html[Project Configuration]

GERRIT
------
Part of link:index.html[Gerrit Code Review]

SEARCHBOX
---------