blob: b665f9c4ea7af81b6e5fa74086a9be21e31a0348 [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]
18 [--require-change-id | --id]
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070019 [[--branch <REF> | -b <REF>] ...]
Shawn O. Pearce47769242011-06-14 16:40:48 -070020 [--empty-commit]
Sasa Zivkova1ec9412013-07-01 15:01:59 +020021 [--max-object-size-limit <N>]
Edwin Kempinfb053c32013-12-04 20:32:41 +010022 [--plugin-config <PARAM> ...]
Shawn O. Pearce47769242011-06-14 16:40:48 -070023 { <NAME> | --name <NAME> }
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080024--
Shawn O. Pearce6e752212009-08-12 12:22:12 -070025
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080026== DESCRIPTION
Shawn O. Pearce6e752212009-08-12 12:22:12 -070027Creates 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
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080038== ACCESS
Shawn O. Pearce897d9212011-06-16 16:59:59 -070039Caller must be a member of the privileged 'Administrators' group,
Fredrik Luthander79d38152012-03-13 09:52:22 +010040or have been granted
41link:access-control.html#capability_createProject[the 'Create Project' global capability].
Shawn O. Pearce6e752212009-08-12 12:22:12 -070042
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080043== SCRIPTING
Shawn O. Pearce6e752212009-08-12 12:22:12 -070044This command is intended to be used in scripts.
45
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080046== OPTIONS
Shawn O. Pearce47769242011-06-14 16:40:48 -070047<NAME>::
48 Required; name of the new project to create. If name ends
49 with `.git` the suffix will be automatically removed.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070050
Shawn O. Pearce47769242011-06-14 16:40:48 -070051--name::
52-n::
53 Deprecated alias for the <NAME> argument. This option may
54 be removed in a future release.
55
56--branch::
57-b::
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070058 Name of the initial branch(es) in the newly created project.
59 Several branches can be specified on the command line.
60 If several branches are specified then the first one becomes HEAD
61 of the project. If none branches are specified then default value
62 ('master') is used.
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070063
Shawn O. Pearce47769242011-06-14 16:40:48 -070064--owner::
65-o::
Hugo Josefson072b4702010-04-21 19:27:11 +020066 Name of the group(s) which will initially own this repository.
67 The specified group(s) must already be defined within Gerrit.
68 Several groups can be specified on the command line.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070069+
Shawn O. Pearce47769242011-06-14 16:40:48 -070070Defaults to what is specified by `repository.*.ownerGroup`
Shawn O. Pearce897d9212011-06-16 16:59:59 -070071in gerrit.config.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070072
Shawn O. Pearce47769242011-06-14 16:40:48 -070073--parent::
74-p::
Shawn O. Pearce9c151142010-04-23 17:03:16 -070075 Name of the parent project to inherit access rights
76 through. If not specified, the parent is set to the default
Shawn O. Pearcea0631822011-06-14 11:18:18 -070077 project `All-Projects`.
Shawn O. Pearce9c151142010-04-23 17:03:16 -070078
Bruce Zucdb3cb82011-12-14 13:27:43 +080079--suggest-parents::
80-S::
81 Suggest parent candidates. This option cannot be used with
82 other arguments. Print out a list of projects that are
83 already parents to other projects, thus it can help the user
84 find a suitable parent for the new project.
85
Shawn O. Pearce47769242011-06-14 16:40:48 -070086--permissions-only::
Shawn O. Pearceaaca9592011-06-14 10:24:49 -070087 Create the project only to serve as a parent for other
88 projects. The new project's Git repository will be
89 initialized to have 'HEAD' point to 'refs/meta/config'.
90
Shawn O. Pearce47769242011-06-14 16:40:48 -070091--description::
92-d::
Shawn O. Pearce6e752212009-08-12 12:22:12 -070093 Initial description of the project. If not specified,
94 no description is stored.
Shawn O. Pearceea6fc172009-09-18 15:40:38 -070095+
96Description values containing spaces should be quoted in single quotes
Shawn O. Pearce47769242011-06-14 16:40:48 -070097('). This most likely requires double quoting the value, for example
98`--description "'A description string'"`.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070099
Shawn O. Pearce47769242011-06-14 16:40:48 -0700100--submit-type::
101-t::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700102 Action used by Gerrit to submit an approved change to its
103 destination branch. Supported options are:
104+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700105* FAST_FORWARD_ONLY: produces a strictly linear history.
106* MERGE_IF_NECESSARY: create a merge commit when required.
David Pursehousea80f0e22013-09-16 22:25:05 +0900107* REBASE_IF_NECESSARY: rebase the commit when required.
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700108* MERGE_ALWAYS: always create a merge commit.
109* CHERRY_PICK: always cherry-pick the commit.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700110
111+
Edwin Kempina79ea552013-11-19 11:24:37 +0100112Defaults to MERGE_IF_NECESSARY unless
113link:config-gerrit.html#repository.name.defaultSubmitType[
114repository.<name>.defaultSubmitType] is set to a different value.
115For more details see link:project-setup.html#submit_type[
Edwin Kempin48cec8f2014-04-17 13:46:32 +0200116Submit Types].
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700117
Shawn O. Pearce47769242011-06-14 16:40:48 -0700118--use-content-merge::
Dmitry Fink876953e2010-09-29 23:44:22 -0700119 If enabled, Gerrit will try to perform a 3-way merge of text
120 file content when a file has been modified by both the
121 destination branch and the change being submitted. This
122 option only takes effect if submit type is not
123 FAST_FORWARD_ONLY. Disabled by default.
124
Shawn O. Pearce47769242011-06-14 16:40:48 -0700125--use-contributor-agreements::
126--ca::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700127 If enabled, authors must complete a contributor agreement
128 on the site before pushing any commits or changes to this
129 project. Disabled by default.
130
Shawn O. Pearce47769242011-06-14 16:40:48 -0700131--use-signed-off-by::
132--so:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700133 If enabled, each change must contain a Signed-off-by line
134 from either the author or the uploader in the commit message.
135 Disabled by default.
136
Shawn O. Pearce47769242011-06-14 16:40:48 -0700137--require-change-id::
138--id::
139 Require a valid link:user-changeid.html[Change-Id] footer
140 in any commit uploaded for review. This does not apply to
141 commits pushed directly to a branch or tag.
142
143--empty-commit::
Shawn Pearceec155112010-10-12 13:58:36 +0200144 Creates an initial empty commit for the Git repository of the
145 project that is newly created.
146
Sasa Zivkova1ec9412013-07-01 15:01:59 +0200147--max-object-size-limit::
148 Define maximum Git object size for this project. Pushes containing an
149 object larger than this limit will be rejected. This can be used to
150 further limit the global
151 link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit]
152 and cannot be used to increase that globally set limit.
153+
154Common unit suffixes of 'k', 'm', or 'g' are supported.
155
Edwin Kempinfb053c32013-12-04 20:32:41 +0100156--plugin-config::
157 A plugin configuration parameter that should be set for this
158 project. The plugin configuration parameter must be specified in
159 the format '<plugin-name>.<parameter-name>=<value>'. Only
160 parameters that are explicitly declared by a plugin can be set.
161 Multiple `--plugin-config` options can be specified to set multiple
162 plugin parameters.
163
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700164
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800165== EXAMPLES
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700166Create a new project called `tools/gerrit`:
167
168====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700169 $ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700170====
171
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700172Create a new project with a description:
173
174====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700175 $ 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 -0700176====
177
178Note that it is necessary to quote the description twice. The local
179shell needs double quotes around the value to ensure the single quotes
180are passed through SSH as-is to the remote Gerrit server, which uses
181the single quotes to delimit the value.
182
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800183== REPLICATION
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700184If the replication plugin is installed, the plugin will attempt to
185perform remote repository creation by a Bourne shell script:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700186
187====
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700188 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 -0700189====
190
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700191For this to work successfully the remote system must be able to run
192arbitrary shell scripts, and must have `git` in the user's PATH
193environment variable. Administrators could also run this command line
194by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700195
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700196A custom extension or plugin may also be developed to implement the
197NewProjectCreatedListener extension point and handle custom logic
198for remote repository creation.
199
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800200== SEE ALSO
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700201
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700202* link:project-setup.html[Project Setup]
203
204GERRIT
205------
206Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700207
208SEARCHBOX
209---------