blob: 099008ddc75216ff0b1a629e2e548c8a6de547fc [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]
11'ssh' -p <port> <host> 'gerrit create-project' \
12\--name <NAME> \
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070013[--branch <REF>] \
Hugo Josefson072b4702010-04-21 19:27:11 +020014[\--owner <GROUP> ...] \
Shawn O. Pearce9c151142010-04-23 17:03:16 -070015[\--parent <NAME>] \
Shawn O. Pearce75aca242010-08-28 16:04:34 -070016[\--permissions-only] \
Shawn O. Pearce6e752212009-08-12 12:22:12 -070017[\--description <DESC>] \
18[\--submit-type <TYPE>] \
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070019[\--use-contributor-agreements] \
20[\--use-signed-off-by]
Shawn O. Pearce6e752212009-08-12 12:22:12 -070021
22DESCRIPTION
23-----------
24Creates a new bare Git repository under `gerrit.basePath`, using
25the project name supplied. The newly created repository is empty
26(has no commits), but is registered in the Gerrit database so that
27the initial commit may be uploaded for review, or initial content
28can be pushed directly into a branch.
29
30If replication is enabled, this command also connects to each of
31the configured remote systems over SSH and uses command line git
32on the remote system to create the empty repository.
33
34
35ACCESS
36------
Hugo Josefson072b4702010-04-21 19:27:11 +020037Caller must be a member of any of the groups defined by
38repository.*.createGroup in gerrit.config.
39
40If there is no such declaration, caller is required to be a member
41of the privileged 'Administrators' group.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070042
43SCRIPTING
44---------
45This command is intended to be used in scripts.
46
47OPTIONS
48-------
49\--name::
50Required; name of the project to create. If name ends with
51`.git` the suffix will be automatically removed.
52
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070053\--branch::
54Name of the initial branch in the newly created project.
55Defaults to 'master'.
56
Shawn O. Pearce6e752212009-08-12 12:22:12 -070057\--owner::
Hugo Josefson072b4702010-04-21 19:27:11 +020058Name of the group(s) which will initially own this repository.
59The specified group(s) must already be defined within Gerrit.
60Several groups can be specified on the command line.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070061+
Hugo Josefson072b4702010-04-21 19:27:11 +020062Defaults to what is specified by repository.*.ownerGroup
63in gerrit.config. If no such declaration(s) exist,
64repository.*.createGroup will be used. If they don't exist,
65`Administrators` will be used.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070066
Shawn O. Pearce9c151142010-04-23 17:03:16 -070067\--parent::
68Name of the parent project to inherit access rights
69through. If not specified, the parent is set to the default
70project `\-- All Projects \--`.
71
Shawn O. Pearce75aca242010-08-28 16:04:34 -070072\--permissions-only::
73Create the project only to serve as a parent for other
74projects. The new project's Git repository will not be
75initialized, and cannot be cloned.
76
Shawn O. Pearce6e752212009-08-12 12:22:12 -070077\--description::
78Initial description of the project. If not specified,
79no description is stored.
Shawn O. Pearceea6fc172009-09-18 15:40:38 -070080+
81Description values containing spaces should be quoted in single quotes
82(\'). This most likely requires double quoting the value, for example
83`\--description "\'A description string\'"`.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070084
85\--submit-type::
86Action used by Gerrit to submit an approved change to its
87destination branch. Supported options are:
88+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070089* FAST_FORWARD_ONLY: produces a strictly linear history.
90* MERGE_IF_NECESSARY: create a merge commit when required.
91* MERGE_ALWAYS: always create a merge commit.
92* CHERRY_PICK: always cherry-pick the commit.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070093
94+
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -070095Defaults to MERGE_IF_NECESSARY. For more details see
Shawn O. Pearce6e752212009-08-12 12:22:12 -070096link:project-setup.html#submit_type[Change Submit Actions].
97
98\--use-contributor-agreements::
99If enabled, authors must complete a contributor agreement
100on the site before pushing any commits or changes to this
101project. Disabled by default.
102
103\--use-signed-off-by::
104If enabled, each change must contain a Signed-off-by line
105from either the author or the uploader in the commit message.
106Disabled by default.
107
108
109EXAMPLES
110--------
111Create a new project called `tools/gerrit`:
112
113====
114$ ssh -p 29418 review.example.com gerrit create-project --name tools/gerrit.git
115====
116
Shawn O. Pearceea6fc172009-09-18 15:40:38 -0700117Create a new project with a description:
118
119====
Shawn O. Pearced6078462009-11-02 10:37:01 -0800120$ 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 -0700121====
122
123Note that it is necessary to quote the description twice. The local
124shell needs double quotes around the value to ensure the single quotes
125are passed through SSH as-is to the remote Gerrit server, which uses
126the single quotes to delimit the value.
127
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700128REPLICATION
129-----------
130The remote repository creation is performed by a Bourne shell script:
131
132====
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700133 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 -0700134====
135
Shawn O. Pearce8c56a8c2009-09-18 19:21:08 -0700136For this to work successfully the remote system must be able to run
137arbitrary shell scripts, and must have `git` in the user's PATH
138environment variable. Administrators could also run this command line
139by hand to establish a new empty repository.
Shawn O. Pearce6e752212009-08-12 12:22:12 -0700140
141SEE ALSO
142--------
143
144* link:config-replication.html[Git Replication/Mirroring]
145* link:project-setup.html[Project Setup]
146
147GERRIT
148------
149Part of link:index.html[Gerrit Code Review]