blob: e8c3857b60109baf5d43e4c6543fe1a10d0ddaa7 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= gerrit create-project
Shawn O. Pearce6e752212009-08-12 12:22:12 -07002
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003== NAME
Shawn O. Pearce6e752212009-08-12 12:22:12 -07004gerrit create-project - Create a new hosted project
5
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006== SYNOPSIS
Michael Ochmanne2d76a12016-06-23 17:07:37 +02007[verse]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08008--
Michael Ochmanne2d76a12016-06-23 17:07:37 +02009_ssh_ -p <port> <host> _gerrit create-project_
Shawn O. Pearce47769242011-06-14 16:40:48 -070010 [--owner <GROUP> ... | -o <GROUP> ...]
11 [--parent <NAME> | -p <NAME> ]
Bruce Zucdb3cb82011-12-14 13:27:43 +080012 [--suggest-parents | -S ]
Shawn O. Pearce47769242011-06-14 16:40:48 -070013 [--permissions-only]
14 [--description <DESC> | -d <DESC>]
Edwin Kempin73b26982012-07-16 13:53:22 +020015 [--submit-type <TYPE> | -t <TYPE>]
Shawn O. Pearce47769242011-06-14 16:40:48 -070016 [--use-contributor-agreements | --ca]
17 [--use-signed-off-by | --so]
18 [--use-content-merge]
Deniz Türkoglu52777272014-09-08 17:02:48 +020019 [--create-new-change-for-all-not-in-target]
Shawn O. Pearce47769242011-06-14 16:40:48 -070020 [--require-change-id | --id]
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070021 [[--branch <REF> | -b <REF>] ...]
Shawn O. Pearce47769242011-06-14 16:40:48 -070022 [--empty-commit]
Sasa Zivkova1ec9412013-07-01 15:01:59 +020023 [--max-object-size-limit <N>]
Edwin Kempinfb053c32013-12-04 20:32:41 +010024 [--plugin-config <PARAM> ...]
Edwin Kempind635d042015-07-21 15:42:04 +020025 { <NAME> }
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080026--
Shawn O. Pearce6e752212009-08-12 12:22:12 -070027
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080028== DESCRIPTION
Shawn O. Pearce6e752212009-08-12 12:22:12 -070029Creates a new bare Git repository under `gerrit.basePath`, using
30the project name supplied. The newly created repository is empty
31(has no commits), but is registered in the Gerrit database so that
32the initial commit may be uploaded for review, or initial content
33can be pushed directly into a branch.
34
35If replication is enabled, this command also connects to each of
36the configured remote systems over SSH and uses command line git
37on the remote system to create the empty repository.
38
39
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080040== ACCESS
Shawn O. Pearce897d9212011-06-16 16:59:59 -070041Caller must be a member of the privileged 'Administrators' group,
Fredrik Luthander79d38152012-03-13 09:52:22 +010042or have been granted
43link:access-control.html#capability_createProject[the 'Create Project' global capability].
Shawn O. Pearce6e752212009-08-12 12:22:12 -070044
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080045== SCRIPTING
Shawn O. Pearce6e752212009-08-12 12:22:12 -070046This command is intended to be used in scripts.
47
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080048== OPTIONS
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--branch::
54-b::
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070055 Name of the initial branch(es) in the newly created project.
56 Several branches can be specified on the command line.
57 If several branches are specified then the first one becomes HEAD
58 of the project. If none branches are specified then default value
59 ('master') is used.
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070060
Shawn O. Pearce47769242011-06-14 16:40:48 -070061--owner::
62-o::
Luca Milanesiod12c6b42018-03-10 00:13:44 +000063 Identifier of the group(s) which will initially own this repository.
64
65 This can be:
66
67 * the UUID of the group
68 * the legacy numeric ID of the group
69 * the name of the group if it is unique
70
Hugo Josefson072b4702010-04-21 19:27:11 +020071 The specified group(s) must already be defined within Gerrit.
72 Several groups can be specified on the command line.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070073+
Shawn O. Pearce47769242011-06-14 16:40:48 -070074Defaults to what is specified by `repository.*.ownerGroup`
Shawn O. Pearce897d9212011-06-16 16:59:59 -070075in gerrit.config.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070076
Shawn O. Pearce47769242011-06-14 16:40:48 -070077--parent::
78-p::
Shawn O. Pearce9c151142010-04-23 17:03:16 -070079 Name of the parent project to inherit access rights
80 through. If not specified, the parent is set to the default
Shawn O. Pearcea0631822011-06-14 11:18:18 -070081 project `All-Projects`.
Shawn O. Pearce9c151142010-04-23 17:03:16 -070082
Bruce Zucdb3cb82011-12-14 13:27:43 +080083--suggest-parents::
84-S::
85 Suggest parent candidates. This option cannot be used with
86 other arguments. Print out a list of projects that are
87 already parents to other projects, thus it can help the user
88 find a suitable parent for the new project.
89
Shawn O. Pearce47769242011-06-14 16:40:48 -070090--permissions-only::
Shawn O. Pearceaaca9592011-06-14 10:24:49 -070091 Create the project only to serve as a parent for other
92 projects. The new project's Git repository will be
93 initialized to have 'HEAD' point to 'refs/meta/config'.
94
Shawn O. Pearce47769242011-06-14 16:40:48 -070095--description::
96-d::
Shawn O. Pearce6e752212009-08-12 12:22:12 -070097 Initial description of the project. If not specified,
98 no description is stored.
Shawn O. Pearceea6fc172009-09-18 15:40:38 -070099+
100Description values containing spaces should be quoted in single quotes
Shawn O. Pearce47769242011-06-14 16:40:48 -0700101('). This most likely requires double quoting the value, for example
102`--description "'A description string'"`.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700103
Shawn O. Pearce47769242011-06-14 16:40:48 -0700104--submit-type::
105-t::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700106 Action used by Gerrit to submit an approved change to its
107 destination branch. Supported options are:
108+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700109* FAST_FORWARD_ONLY: produces a strictly linear history.
110* MERGE_IF_NECESSARY: create a merge commit when required.
David Pursehousea80f0e22013-09-16 22:25:05 +0900111* REBASE_IF_NECESSARY: rebase the commit when required.
Gert van Dijka4e49d02017-08-27 22:50:40 +0200112* REBASE_ALWAYS: always rebase the commit including dependencies.
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700113* MERGE_ALWAYS: always create a merge commit.
114* CHERRY_PICK: always cherry-pick the commit.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700115
116+
Edwin Kempina79ea552013-11-19 11:24:37 +0100117Defaults to MERGE_IF_NECESSARY unless
118link:config-gerrit.html#repository.name.defaultSubmitType[
119repository.<name>.defaultSubmitType] is set to a different value.
Stefan Lay08ba4732014-05-05 16:36:12 +0200120For more details see link:project-configuration.html#submit_type[
Edwin Kempin48cec8f2014-04-17 13:46:32 +0200121Submit Types].
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700122
Shawn O. Pearce47769242011-06-14 16:40:48 -0700123--use-content-merge::
Dmitry Fink876953e2010-09-29 23:44:22 -0700124 If enabled, Gerrit will try to perform a 3-way merge of text
125 file content when a file has been modified by both the
126 destination branch and the change being submitted. This
127 option only takes effect if submit type is not
128 FAST_FORWARD_ONLY. Disabled by default.
129
Shawn O. Pearce47769242011-06-14 16:40:48 -0700130--use-contributor-agreements::
131--ca::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700132 If enabled, authors must complete a contributor agreement
133 on the site before pushing any commits or changes to this
134 project. Disabled by default.
135
Shawn O. Pearce47769242011-06-14 16:40:48 -0700136--use-signed-off-by::
137--so:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700138 If enabled, each change must contain a Signed-off-by line
139 from either the author or the uploader in the commit message.
140 Disabled by default.
141
Deniz Türkoglu52777272014-09-08 17:02:48 +0200142--create-new-change-for-all-not-in-target::
143--ncfa:
David Pursehouse7c603df2014-12-03 17:30:39 +0900144 If enabled, a new change is created for every commit that is not in
145 the target branch. If the pushed commit is a merge commit, this flag is
146 ignored for that push. To avoid accidental creation of a large number
147 of open changes, this option also does not accept merge commits in the
148 commit chain.
Deniz Türkoglu52777272014-09-08 17:02:48 +0200149 Disabled by default.
150
Shawn O. Pearce47769242011-06-14 16:40:48 -0700151--require-change-id::
152--id::
153 Require a valid link:user-changeid.html[Change-Id] footer
154 in any commit uploaded for review. This does not apply to
155 commits pushed directly to a branch or tag.
156
157--empty-commit::
Shawn Pearceec155112010-10-12 13:58:36 +0200158 Creates an initial empty commit for the Git repository of the
159 project that is newly created.
160
Sasa Zivkova1ec9412013-07-01 15:01:59 +0200161--max-object-size-limit::
162 Define maximum Git object size for this project. Pushes containing an
163 object larger than this limit will be rejected. This can be used to
164 further limit the global
165 link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit]
166 and cannot be used to increase that globally set limit.
167+
168Common unit suffixes of 'k', 'm', or 'g' are supported.
169
Edwin Kempinfb053c32013-12-04 20:32:41 +0100170--plugin-config::
171 A plugin configuration parameter that should be set for this
172 project. The plugin configuration parameter must be specified in
173 the format '<plugin-name>.<parameter-name>=<value>'. Only
174 parameters that are explicitly declared by a plugin can be set.
175 Multiple `--plugin-config` options can be specified to set multiple
176 plugin parameters.
177
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700178
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800179== EXAMPLES
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700180Create a new project called `tools/gerrit`:
181
Michael Ochmannb99feab2016-07-06 14:10:22 +0200182----
Shawn O. Pearce47769242011-06-14 16:40:48 -0700183 $ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git
Michael Ochmannb99feab2016-07-06 14:10:22 +0200184----
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700185
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700186Create a new project with a description:
187
Michael Ochmannb99feab2016-07-06 14:10:22 +0200188----
Shawn O. Pearce47769242011-06-14 16:40:48 -0700189 $ ssh -p 29418 review.example.com gerrit create-project tool.git --description "'Tools used by build system'"
Michael Ochmannb99feab2016-07-06 14:10:22 +0200190----
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700191
192Note that it is necessary to quote the description twice. The local
193shell needs double quotes around the value to ensure the single quotes
194are passed through SSH as-is to the remote Gerrit server, which uses
195the single quotes to delimit the value.
196
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800197== REPLICATION
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700198If the replication plugin is installed, the plugin will attempt to
199perform remote repository creation by a Bourne shell script:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700200
Michael Ochmannb99feab2016-07-06 14:10:22 +0200201----
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700202 mkdir -p '/base/project.git' && cd '/base/project.git' && git init --bare && git update-ref HEAD refs/heads/master
Michael Ochmannb99feab2016-07-06 14:10:22 +0200203----
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700204
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700205For this to work successfully the remote system must be able to run
206arbitrary shell scripts, and must have `git` in the user's PATH
207environment variable. Administrators could also run this command line
208by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700209
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700210A custom extension or plugin may also be developed to implement the
211NewProjectCreatedListener extension point and handle custom logic
212for remote repository creation.
213
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800214== SEE ALSO
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700215
Stefan Lay08ba4732014-05-05 16:36:12 +0200216* link:project-configuration.html[Project Configuration]
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700217
218GERRIT
219------
220Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700221
222SEARCHBOX
223---------