blob: f22141c9a41ae03ed3794cc6db379d23d1d329ef [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>]
17 [--submit-type <TYPE> | -t <TYPE>]
18 [--use-contributor-agreements | --ca]
19 [--use-signed-off-by | --so]
20 [--use-content-merge]
21 [--require-change-id | --id]
22 [--branch <REF> | -b <REF>]
23 [--empty-commit]
24 { <NAME> | --name <NAME> }
Shawn O. Pearce6e752212009-08-12 12:22:12 -070025
26DESCRIPTION
27-----------
28Creates 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
39ACCESS
40------
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
45SCRIPTING
46---------
47This command is intended to be used in scripts.
48
49OPTIONS
50-------
Shawn O. Pearce47769242011-06-14 16:40:48 -070051<NAME>::
52Required; name of the new project to create. If name ends
53with `.git` the suffix will be automatically removed.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070054
Shawn O. Pearce47769242011-06-14 16:40:48 -070055--name::
56-n::
57Deprecated alias for the <NAME> argument. This option may
58be removed in a future release.
59
60--branch::
61-b::
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070062Name of the initial branch in the newly created project.
63Defaults to 'master'.
64
Shawn O. Pearce47769242011-06-14 16:40:48 -070065--owner::
66-o::
Hugo Josefson072b4702010-04-21 19:27:11 +020067Name of the group(s) which will initially own this repository.
68The specified group(s) must already be defined within Gerrit.
69Several 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 -070076Name of the parent project to inherit access rights
77through. If not specified, the parent is set to the default
Shawn O. Pearcea0631822011-06-14 11:18:18 -070078project `All-Projects`.
Shawn O. Pearce9c151142010-04-23 17:03:16 -070079
Bruce Zucdb3cb82011-12-14 13:27:43 +080080--suggest-parents::
81-S::
82Suggest parent candidates. This option cannot be used with
83other arguments. Print out a list of projects that are
84already parents to other projects, thus it can help the user
85find 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 -070088Create the project only to serve as a parent for other
89projects. The new project's Git repository will be
90initialized 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 -070094Initial description of the project. If not specified,
95no 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 -0700103Action used by Gerrit to submit an approved change to its
104destination 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.
108* 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+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700112Defaults to MERGE_IF_NECESSARY. For more details see
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700113link:project-setup.html#submit_type[Change Submit Actions].
114
Shawn O. Pearce47769242011-06-14 16:40:48 -0700115--use-content-merge::
Dmitry Fink876953e2010-09-29 23:44:22 -0700116If enabled, Gerrit will try to perform a 3-way merge of text
117file content when a file has been modified by both the
118destination branch and the change being submitted. This
119option only takes effect if submit type is not
120FAST_FORWARD_ONLY. Disabled by default.
121
Shawn O. Pearce47769242011-06-14 16:40:48 -0700122--use-contributor-agreements::
123--ca::
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700124If enabled, authors must complete a contributor agreement
125on the site before pushing any commits or changes to this
126project. Disabled by default.
127
Shawn O. Pearce47769242011-06-14 16:40:48 -0700128--use-signed-off-by::
129--so:
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700130If enabled, each change must contain a Signed-off-by line
131from either the author or the uploader in the commit message.
132Disabled by default.
133
Shawn O. Pearce47769242011-06-14 16:40:48 -0700134--require-change-id::
135--id::
136Require a valid link:user-changeid.html[Change-Id] footer
137in any commit uploaded for review. This does not apply to
138commits pushed directly to a branch or tag.
139
140--empty-commit::
Shawn Pearceec155112010-10-12 13:58:36 +0200141Creates an initial empty commit for the Git repository of the
142project that is newly created.
143
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700144
145EXAMPLES
146--------
147Create a new project called `tools/gerrit`:
148
149====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700150$ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700151====
152
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700153Create a new project with a description:
154
155====
Shawn O. Pearce47769242011-06-14 16:40:48 -0700156$ 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 -0700157====
158
159Note that it is necessary to quote the description twice. The local
160shell needs double quotes around the value to ensure the single quotes
161are passed through SSH as-is to the remote Gerrit server, which uses
162the single quotes to delimit the value.
163
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700164REPLICATION
165-----------
166The remote repository creation is performed by a Bourne shell script:
167
168====
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700169 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 -0700170====
171
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700172For this to work successfully the remote system must be able to run
173arbitrary shell scripts, and must have `git` in the user's PATH
174environment variable. Administrators could also run this command line
175by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700176
177SEE ALSO
178--------
179
180* link:config-replication.html[Git Replication/Mirroring]
181* link:project-setup.html[Project Setup]
182
183GERRIT
184------
185Part of link:index.html[Gerrit Code Review]