blob: 666fe91b018ff7c50ff745142201847b5047c827 [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> ]
Bruce Zucdb3cb82011-12-14 13:27:43 +080014 [--suggest-parents | -S ]
Shawn O. Pearce47769242011-06-14 16:40:48 -070015 [--permissions-only]
16 [--description <DESC> | -d <DESC>]
Edwin Kempin73b26982012-07-16 13:53:22 +020017 [--submit-type <TYPE> | -t <TYPE>]
Shawn O. Pearce47769242011-06-14 16:40:48 -070018 [--use-contributor-agreements | --ca]
19 [--use-signed-off-by | --so]
20 [--use-content-merge]
21 [--require-change-id | --id]
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070022 [[--branch <REF> | -b <REF>] ...]
Shawn O. Pearce47769242011-06-14 16:40:48 -070023 [--empty-commit]
Sasa Zivkova1ec9412013-07-01 15:01:59 +020024 [--max-object-size-limit <N>]
Shawn O. Pearce47769242011-06-14 16:40:48 -070025 { <NAME> | --name <NAME> }
Shawn O. Pearce6e752212009-08-12 12:22:12 -070026
27DESCRIPTION
28-----------
29Creates 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
40ACCESS
41------
Shawn O. Pearce897d9212011-06-16 16:59:59 -070042Caller must be a member of the privileged 'Administrators' group,
Fredrik Luthander79d38152012-03-13 09:52:22 +010043or have been granted
44link:access-control.html#capability_createProject[the 'Create Project' global capability].
Shawn O. Pearce6e752212009-08-12 12:22:12 -070045
46SCRIPTING
47---------
48This command is intended to be used in scripts.
49
50OPTIONS
51-------
Shawn O. Pearce47769242011-06-14 16:40:48 -070052<NAME>::
53Required; name of the new project to create. If name ends
54with `.git` the suffix will be automatically removed.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070055
Shawn O. Pearce47769242011-06-14 16:40:48 -070056--name::
57-n::
58Deprecated alias for the <NAME> argument. This option may
59be removed in a future release.
60
61--branch::
62-b::
Anatol Pomazaua54b03d2012-05-03 11:43:22 -070063Name of the initial branch(es) in the newly created project.
64Several branches can be specified on the command line.
65If several branches are specified then the first one becomes HEAD
66of the project. If none branches are specified then default value
67('master') is used.
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070068
Shawn O. Pearce47769242011-06-14 16:40:48 -070069--owner::
70-o::
Hugo Josefson072b4702010-04-21 19:27:11 +020071Name of the group(s) which will initially own this repository.
72The specified group(s) must already be defined within Gerrit.
73Several groups can be specified on the command line.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070074+
Shawn O. Pearce47769242011-06-14 16:40:48 -070075Defaults to what is specified by `repository.*.ownerGroup`
Shawn O. Pearce897d9212011-06-16 16:59:59 -070076in gerrit.config.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070077
Shawn O. Pearce47769242011-06-14 16:40:48 -070078--parent::
79-p::
Shawn O. Pearce9c151142010-04-23 17:03:16 -070080Name of the parent project to inherit access rights
81through. If not specified, the parent is set to the default
Shawn O. Pearcea0631822011-06-14 11:18:18 -070082project `All-Projects`.
Shawn O. Pearce9c151142010-04-23 17:03:16 -070083
Bruce Zucdb3cb82011-12-14 13:27:43 +080084--suggest-parents::
85-S::
86Suggest parent candidates. This option cannot be used with
87other arguments. Print out a list of projects that are
88already parents to other projects, thus it can help the user
89find a suitable parent for the new project.
90
Shawn O. Pearce47769242011-06-14 16:40:48 -070091--permissions-only::
Shawn O. Pearceaaca9592011-06-14 10:24:49 -070092Create the project only to serve as a parent for other
93projects. The new project's Git repository will be
94initialized to have 'HEAD' point to 'refs/meta/config'.
95
Shawn O. Pearce47769242011-06-14 16:40:48 -070096--description::
97-d::
Shawn O. Pearce6e752212009-08-12 12:22:12 -070098Initial description of the project. If not specified,
99no description is stored.
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700100+
101Description values containing spaces should be quoted in single quotes
Shawn O. Pearce47769242011-06-14 16:40:48 -0700102('). This most likely requires double quoting the value, for example
103`--description "'A description string'"`.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700104
Shawn O. Pearce47769242011-06-14 16:40:48 -0700105--submit-type::
106-t::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700107Action used by Gerrit to submit an approved change to its
108destination branch. Supported options are:
109+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700110* FAST_FORWARD_ONLY: produces a strictly linear history.
111* MERGE_IF_NECESSARY: create a merge commit when required.
112* MERGE_ALWAYS: always create a merge commit.
113* CHERRY_PICK: always cherry-pick the commit.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700114
115+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700116Defaults to MERGE_IF_NECESSARY. For more details see
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700117link:project-setup.html#submit_type[Change Submit Actions].
118
Shawn O. Pearce47769242011-06-14 16:40:48 -0700119--use-content-merge::
Dmitry Fink876953e2010-09-29 23:44:22 -0700120If enabled, Gerrit will try to perform a 3-way merge of text
121file content when a file has been modified by both the
122destination branch and the change being submitted. This
123option only takes effect if submit type is not
124FAST_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 -0700128If enabled, authors must complete a contributor agreement
129on the site before pushing any commits or changes to this
130project. 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 -0700134If enabled, each change must contain a Signed-off-by line
135from either the author or the uploader in the commit message.
136Disabled by default.
137
Shawn O. Pearce47769242011-06-14 16:40:48 -0700138--require-change-id::
139--id::
140Require a valid link:user-changeid.html[Change-Id] footer
141in any commit uploaded for review. This does not apply to
142commits pushed directly to a branch or tag.
143
144--empty-commit::
Shawn Pearceec155112010-10-12 13:58:36 +0200145Creates an initial empty commit for the Git repository of the
146project that is newly created.
147
Sasa Zivkova1ec9412013-07-01 15:01:59 +0200148--max-object-size-limit::
149Define maximum Git object size for this project. Pushes containing an
150object larger than this limit will be rejected. This can be used to
151further limit the global
152 link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit]
153and cannot be used to increase that globally set limit.
154+
155Common unit suffixes of 'k', 'm', or 'g' are supported.
156
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700157
158EXAMPLES
159--------
160Create a new project called `tools/gerrit`:
161
162====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700163$ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700164====
165
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700166Create a new project with a description:
167
168====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700169$ 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 -0700170====
171
172Note that it is necessary to quote the description twice. The local
173shell needs double quotes around the value to ensure the single quotes
174are passed through SSH as-is to the remote Gerrit server, which uses
175the single quotes to delimit the value.
176
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700177REPLICATION
178-----------
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700179If the replication plugin is installed, the plugin will attempt to
180perform remote repository creation by a Bourne shell script:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700181
182====
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700183 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 -0700184====
185
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700186For this to work successfully the remote system must be able to run
187arbitrary shell scripts, and must have `git` in the user's PATH
188environment variable. Administrators could also run this command line
189by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700190
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700191A custom extension or plugin may also be developed to implement the
192NewProjectCreatedListener extension point and handle custom logic
193for remote repository creation.
194
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700195SEE ALSO
196--------
197
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700198* link:project-setup.html[Project Setup]
199
200GERRIT
201------
202Part of link:index.html[Gerrit Code Review]