blob: d4c5635524067f52c9e3ad68b884f368779c3001 [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]
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010011 'ssh' -p <port> <host> 'gerrit create-project' \
12 --name <NAME> \
13 [--branch <REF>] \
14 [\--owner <GROUP> ...] \
15 [\--parent <NAME>] \
Shawn O. Pearceaaca9592011-06-14 10:24:49 -070016 [\--permissions-only] \
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010017 [\--description <DESC>] \
18 [\--submit-type <TYPE>] \
19 [\--use-content-merge] \
20 [\--use-contributor-agreements] \
21 [\--use-signed-off-by] \
22 [\--empty-commit]
Shawn O. Pearce6e752212009-08-12 12:22:12 -070023
24DESCRIPTION
25-----------
26Creates a new bare Git repository under `gerrit.basePath`, using
27the project name supplied. The newly created repository is empty
28(has no commits), but is registered in the Gerrit database so that
29the initial commit may be uploaded for review, or initial content
30can be pushed directly into a branch.
31
32If replication is enabled, this command also connects to each of
33the configured remote systems over SSH and uses command line git
34on the remote system to create the empty repository.
35
36
37ACCESS
38------
Hugo Josefson072b4702010-04-21 19:27:11 +020039Caller must be a member of any of the groups defined by
40repository.*.createGroup in gerrit.config.
41
42If there is no such declaration, caller is required to be a member
43of the privileged 'Administrators' group.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070044
45SCRIPTING
46---------
47This command is intended to be used in scripts.
48
49OPTIONS
50-------
51\--name::
52 Required; name of the project to create. If name ends with
53 `.git` the suffix will be automatically removed.
54
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070055\--branch::
56 Name of the initial branch in the newly created project.
57 Defaults to 'master'.
58
Shawn O. Pearce6e752212009-08-12 12:22:12 -070059\--owner::
Hugo Josefson072b4702010-04-21 19:27:11 +020060 Name of the group(s) which will initially own this repository.
61 The specified group(s) must already be defined within Gerrit.
62 Several groups can be specified on the command line.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070063+
Hugo Josefson072b4702010-04-21 19:27:11 +020064Defaults to what is specified by repository.*.ownerGroup
65in gerrit.config. If no such declaration(s) exist,
66repository.*.createGroup will be used. If they don't exist,
67`Administrators` will be used.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070068
Shawn O. Pearce9c151142010-04-23 17:03:16 -070069\--parent::
70 Name of the parent project to inherit access rights
71 through. If not specified, the parent is set to the default
72 project `\-- All Projects \--`.
73
Shawn O. Pearceaaca9592011-06-14 10:24:49 -070074\--permissions-only::
75 Create the project only to serve as a parent for other
76 projects. The new project's Git repository will be
77 initialized to have 'HEAD' point to 'refs/meta/config'.
78
Shawn O. Pearce6e752212009-08-12 12:22:12 -070079\--description::
80 Initial description of the project. If not specified,
81 no description is stored.
Shawn O. Pearceea6fc172009-09-18 15:40:38 -070082+
83Description values containing spaces should be quoted in single quotes
84(\'). This most likely requires double quoting the value, for example
85`\--description "\'A description string\'"`.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070086
87\--submit-type::
88 Action used by Gerrit to submit an approved change to its
89 destination branch. Supported options are:
90+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070091* FAST_FORWARD_ONLY: produces a strictly linear history.
92* MERGE_IF_NECESSARY: create a merge commit when required.
93* MERGE_ALWAYS: always create a merge commit.
94* CHERRY_PICK: always cherry-pick the commit.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070095
96+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070097Defaults to MERGE_IF_NECESSARY. For more details see
Shawn O. Pearce6e752212009-08-12 12:22:12 -070098link:project-setup.html#submit_type[Change Submit Actions].
99
Dmitry Fink876953e2010-09-29 23:44:22 -0700100\--use-content-merge::
101 If enabled, Gerrit will try to perform a 3-way merge of text
102 file content when a file has been modified by both the
103 destination branch and the change being submitted. This
104 option only takes effect if submit type is not
105 FAST_FORWARD_ONLY. Disabled by default.
106
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700107\--use-contributor-agreements::
108 If enabled, authors must complete a contributor agreement
109 on the site before pushing any commits or changes to this
110 project. Disabled by default.
111
112\--use-signed-off-by::
113 If enabled, each change must contain a Signed-off-by line
114 from either the author or the uploader in the commit message.
115 Disabled by default.
116
Shawn Pearceec155112010-10-12 13:58:36 +0200117\--empty-commit:
118 Creates an initial empty commit for the Git repository of the
119 project that is newly created.
120
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700121
122EXAMPLES
123--------
124Create a new project called `tools/gerrit`:
125
126====
127 $ ssh -p 29418 review.example.com gerrit create-project --name tools/gerrit.git
128====
129
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700130Create a new project with a description:
131
132====
Shawn O. Pearced6078462009-11-02 10:37:01 -0800133 $ ssh -p 29418 review.example.com gerrit create-project --name tool.git --description "'Tools used by build system'"
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700134====
135
136Note that it is necessary to quote the description twice. The local
137shell needs double quotes around the value to ensure the single quotes
138are passed through SSH as-is to the remote Gerrit server, which uses
139the single quotes to delimit the value.
140
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700141REPLICATION
142-----------
143The remote repository creation is performed by a Bourne shell script:
144
145====
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700146 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 -0700147====
148
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700149For this to work successfully the remote system must be able to run
150arbitrary shell scripts, and must have `git` in the user's PATH
151environment variable. Administrators could also run this command line
152by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700153
154SEE ALSO
155--------
156
157* link:config-replication.html[Git Replication/Mirroring]
158* link:project-setup.html[Project Setup]
159
160GERRIT
161------
162Part of link:index.html[Gerrit Code Review]