blob: 31b4538075641f5ad0490f8801234da8baf0f392 [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
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08007--
Shawn O. Pearce47769242011-06-14 16:40:48 -07008'ssh' -p <port> <host> 'gerrit create-project'
9 [--owner <GROUP> ... | -o <GROUP> ...]
10 [--parent <NAME> | -p <NAME> ]
Bruce Zucdb3cb82011-12-14 13:27:43 +080011 [--suggest-parents | -S ]
Shawn O. Pearce47769242011-06-14 16:40:48 -070012 [--permissions-only]
13 [--description <DESC> | -d <DESC>]
Edwin Kempin73b26982012-07-16 13:53:22 +020014 [--submit-type <TYPE> | -t <TYPE>]
Shawn O. Pearce47769242011-06-14 16:40:48 -070015 [--use-contributor-agreements | --ca]
16 [--use-signed-off-by | --so]
17 [--use-content-merge]
Deniz Türkoglu52777272014-09-08 17:02:48 +020018 [--create-new-change-for-all-not-in-target]
Shawn O. Pearce47769242011-06-14 16:40:48 -070019 [--require-change-id | --id]
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070020 [[--branch <REF> | -b <REF>] ...]
Shawn O. Pearce47769242011-06-14 16:40:48 -070021 [--empty-commit]
Sasa Zivkova1ec9412013-07-01 15:01:59 +020022 [--max-object-size-limit <N>]
Edwin Kempinfb053c32013-12-04 20:32:41 +010023 [--plugin-config <PARAM> ...]
Shawn O. Pearce47769242011-06-14 16:40:48 -070024 { <NAME> | --name <NAME> }
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080025--
Shawn O. Pearce6e752212009-08-12 12:22:12 -070026
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080027== DESCRIPTION
Shawn O. Pearce6e752212009-08-12 12:22:12 -070028Creates a new bare Git repository under `gerrit.basePath`, using
29the project name supplied. The newly created repository is empty
30(has no commits), but is registered in the Gerrit database so that
31the initial commit may be uploaded for review, or initial content
32can be pushed directly into a branch.
33
34If replication is enabled, this command also connects to each of
35the configured remote systems over SSH and uses command line git
36on the remote system to create the empty repository.
37
38
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080039== ACCESS
Shawn O. Pearce897d9212011-06-16 16:59:59 -070040Caller must be a member of the privileged 'Administrators' group,
Fredrik Luthander79d38152012-03-13 09:52:22 +010041or have been granted
42link:access-control.html#capability_createProject[the 'Create Project' global capability].
Shawn O. Pearce6e752212009-08-12 12:22:12 -070043
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080044== SCRIPTING
Shawn O. Pearce6e752212009-08-12 12:22:12 -070045This command is intended to be used in scripts.
46
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080047== OPTIONS
Shawn O. Pearce47769242011-06-14 16:40:48 -070048<NAME>::
49 Required; name of the new project to create. If name ends
50 with `.git` the suffix will be automatically removed.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070051
Shawn O. Pearce47769242011-06-14 16:40:48 -070052--name::
53-n::
54 Deprecated alias for the <NAME> argument. This option may
55 be removed in a future release.
56
57--branch::
58-b::
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070059 Name of the initial branch(es) in the newly created project.
60 Several branches can be specified on the command line.
61 If several branches are specified then the first one becomes HEAD
62 of the project. If none branches are specified then default value
63 ('master') is used.
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070064
Shawn O. Pearce47769242011-06-14 16:40:48 -070065--owner::
66-o::
Hugo Josefson072b4702010-04-21 19:27:11 +020067 Name of the group(s) which will initially own this repository.
68 The specified group(s) must already be defined within Gerrit.
69 Several groups can be specified on the command line.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070070+
Shawn O. Pearce47769242011-06-14 16:40:48 -070071Defaults to what is specified by `repository.*.ownerGroup`
Shawn O. Pearce897d9212011-06-16 16:59:59 -070072in gerrit.config.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070073
Shawn O. Pearce47769242011-06-14 16:40:48 -070074--parent::
75-p::
Shawn O. Pearce9c151142010-04-23 17:03:16 -070076 Name of the parent project to inherit access rights
77 through. If not specified, the parent is set to the default
Shawn O. Pearcea0631822011-06-14 11:18:18 -070078 project `All-Projects`.
Shawn O. Pearce9c151142010-04-23 17:03:16 -070079
Bruce Zucdb3cb82011-12-14 13:27:43 +080080--suggest-parents::
81-S::
82 Suggest parent candidates. This option cannot be used with
83 other arguments. Print out a list of projects that are
84 already parents to other projects, thus it can help the user
85 find a suitable parent for the new project.
86
Shawn O. Pearce47769242011-06-14 16:40:48 -070087--permissions-only::
Shawn O. Pearceaaca9592011-06-14 10:24:49 -070088 Create the project only to serve as a parent for other
89 projects. The new project's Git repository will be
90 initialized to have 'HEAD' point to 'refs/meta/config'.
91
Shawn O. Pearce47769242011-06-14 16:40:48 -070092--description::
93-d::
Shawn O. Pearce6e752212009-08-12 12:22:12 -070094 Initial description of the project. If not specified,
95 no description is stored.
Shawn O. Pearceea6fc172009-09-18 15:40:38 -070096+
97Description values containing spaces should be quoted in single quotes
Shawn O. Pearce47769242011-06-14 16:40:48 -070098('). This most likely requires double quoting the value, for example
99`--description "'A description string'"`.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700100
Shawn O. Pearce47769242011-06-14 16:40:48 -0700101--submit-type::
102-t::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700103 Action used by Gerrit to submit an approved change to its
104 destination branch. Supported options are:
105+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700106* FAST_FORWARD_ONLY: produces a strictly linear history.
107* MERGE_IF_NECESSARY: create a merge commit when required.
David Pursehousea80f0e22013-09-16 22:25:05 +0900108* REBASE_IF_NECESSARY: rebase the commit when required.
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700109* MERGE_ALWAYS: always create a merge commit.
110* CHERRY_PICK: always cherry-pick the commit.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700111
112+
Edwin Kempina79ea552013-11-19 11:24:37 +0100113Defaults to MERGE_IF_NECESSARY unless
114link:config-gerrit.html#repository.name.defaultSubmitType[
115repository.<name>.defaultSubmitType] is set to a different value.
Stefan Lay08ba4732014-05-05 16:36:12 +0200116For more details see link:project-configuration.html#submit_type[
Edwin Kempin48cec8f2014-04-17 13:46:32 +0200117Submit Types].
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700118
Shawn O. Pearce47769242011-06-14 16:40:48 -0700119--use-content-merge::
Dmitry Fink876953e2010-09-29 23:44:22 -0700120 If enabled, Gerrit will try to perform a 3-way merge of text
121 file content when a file has been modified by both the
122 destination branch and the change being submitted. This
123 option only takes effect if submit type is not
124 FAST_FORWARD_ONLY. Disabled by default.
125
Shawn O. Pearce47769242011-06-14 16:40:48 -0700126--use-contributor-agreements::
127--ca::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700128 If enabled, authors must complete a contributor agreement
129 on the site before pushing any commits or changes to this
130 project. Disabled by default.
131
Shawn O. Pearce47769242011-06-14 16:40:48 -0700132--use-signed-off-by::
133--so:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700134 If enabled, each change must contain a Signed-off-by line
135 from either the author or the uploader in the commit message.
136 Disabled by default.
137
Deniz Türkoglu52777272014-09-08 17:02:48 +0200138--create-new-change-for-all-not-in-target::
139--ncfa:
David Pursehouse7c603df2014-12-03 17:30:39 +0900140 If enabled, a new change is created for every commit that is not in
141 the target branch. If the pushed commit is a merge commit, this flag is
142 ignored for that push. To avoid accidental creation of a large number
143 of open changes, this option also does not accept merge commits in the
144 commit chain.
Deniz Türkoglu52777272014-09-08 17:02:48 +0200145 Disabled by default.
146
Shawn O. Pearce47769242011-06-14 16:40:48 -0700147--require-change-id::
148--id::
149 Require a valid link:user-changeid.html[Change-Id] footer
150 in any commit uploaded for review. This does not apply to
151 commits pushed directly to a branch or tag.
152
153--empty-commit::
Shawn Pearceec155112010-10-12 13:58:36 +0200154 Creates an initial empty commit for the Git repository of the
155 project that is newly created.
156
Sasa Zivkova1ec9412013-07-01 15:01:59 +0200157--max-object-size-limit::
158 Define maximum Git object size for this project. Pushes containing an
159 object larger than this limit will be rejected. This can be used to
160 further limit the global
161 link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit]
162 and cannot be used to increase that globally set limit.
163+
164Common unit suffixes of 'k', 'm', or 'g' are supported.
165
Edwin Kempinfb053c32013-12-04 20:32:41 +0100166--plugin-config::
167 A plugin configuration parameter that should be set for this
168 project. The plugin configuration parameter must be specified in
169 the format '<plugin-name>.<parameter-name>=<value>'. Only
170 parameters that are explicitly declared by a plugin can be set.
171 Multiple `--plugin-config` options can be specified to set multiple
172 plugin parameters.
173
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700174
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800175== EXAMPLES
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700176Create a new project called `tools/gerrit`:
177
178====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700179 $ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700180====
181
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700182Create a new project with a description:
183
184====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700185 $ 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 -0700186====
187
188Note that it is necessary to quote the description twice. The local
189shell needs double quotes around the value to ensure the single quotes
190are passed through SSH as-is to the remote Gerrit server, which uses
191the single quotes to delimit the value.
192
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800193== REPLICATION
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700194If the replication plugin is installed, the plugin will attempt to
195perform remote repository creation by a Bourne shell script:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700196
197====
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700198 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 -0700199====
200
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700201For this to work successfully the remote system must be able to run
202arbitrary shell scripts, and must have `git` in the user's PATH
203environment variable. Administrators could also run this command line
204by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700205
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700206A custom extension or plugin may also be developed to implement the
207NewProjectCreatedListener extension point and handle custom logic
208for remote repository creation.
209
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800210== SEE ALSO
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700211
Stefan Lay08ba4732014-05-05 16:36:12 +0200212* link:project-configuration.html[Project Configuration]
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700213
214GERRIT
215------
216Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700217
218SEARCHBOX
219---------