| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 1 | gerrit create-project |
| 2 | ===================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | gerrit create-project - Create a new hosted project |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | [verse] |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 11 | 'ssh' -p <port> <host> 'gerrit create-project' |
| 12 | [--owner <GROUP> ... | -o <GROUP> ...] |
| 13 | [--parent <NAME> | -p <NAME> ] |
| Bruce Zu | cdb3cb8 | 2011-12-14 13:27:43 +0800 | [diff] [blame] | 14 | [--suggest-parents | -S ] |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 15 | [--permissions-only] |
| 16 | [--description <DESC> | -d <DESC>] |
| Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 17 | [--submit-type <TYPE> | -t <TYPE>] |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 18 | [--use-contributor-agreements | --ca] |
| 19 | [--use-signed-off-by | --so] |
| 20 | [--use-content-merge] |
| 21 | [--require-change-id | --id] |
| Anatol Pomazau | a54b03d | 2012-05-03 11:43:22 -0700 | [diff] [blame] | 22 | [[--branch <REF> | -b <REF>] ...] |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 23 | [--empty-commit] |
| Sasa Zivkov | a1ec941 | 2013-07-01 15:01:59 +0200 | [diff] [blame^] | 24 | [--max-object-size-limit <N>] |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 25 | { <NAME> | --name <NAME> } |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 26 | |
| 27 | DESCRIPTION |
| 28 | ----------- |
| 29 | Creates a new bare Git repository under `gerrit.basePath`, using |
| 30 | the project name supplied. The newly created repository is empty |
| 31 | (has no commits), but is registered in the Gerrit database so that |
| 32 | the initial commit may be uploaded for review, or initial content |
| 33 | can be pushed directly into a branch. |
| 34 | |
| 35 | If replication is enabled, this command also connects to each of |
| 36 | the configured remote systems over SSH and uses command line git |
| 37 | on the remote system to create the empty repository. |
| 38 | |
| 39 | |
| 40 | ACCESS |
| 41 | ------ |
| Shawn O. Pearce | 897d921 | 2011-06-16 16:59:59 -0700 | [diff] [blame] | 42 | Caller must be a member of the privileged 'Administrators' group, |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame] | 43 | or have been granted |
| 44 | link:access-control.html#capability_createProject[the 'Create Project' global capability]. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 45 | |
| 46 | SCRIPTING |
| 47 | --------- |
| 48 | This command is intended to be used in scripts. |
| 49 | |
| 50 | OPTIONS |
| 51 | ------- |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 52 | <NAME>:: |
| 53 | Required; name of the new project to create. If name ends |
| 54 | with `.git` the suffix will be automatically removed. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 55 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 56 | --name:: |
| 57 | -n:: |
| 58 | Deprecated alias for the <NAME> argument. This option may |
| 59 | be removed in a future release. |
| 60 | |
| 61 | --branch:: |
| 62 | -b:: |
| Anatol Pomazau | a54b03d | 2012-05-03 11:43:22 -0700 | [diff] [blame] | 63 | Name of the initial branch(es) in the newly created project. |
| 64 | Several branches can be specified on the command line. |
| 65 | If several branches are specified then the first one becomes HEAD |
| 66 | of the project. If none branches are specified then default value |
| 67 | ('master') is used. |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 68 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 69 | --owner:: |
| 70 | -o:: |
| Hugo Josefson | 072b470 | 2010-04-21 19:27:11 +0200 | [diff] [blame] | 71 | Name of the group(s) which will initially own this repository. |
| 72 | The specified group(s) must already be defined within Gerrit. |
| 73 | Several groups can be specified on the command line. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 74 | + |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 75 | Defaults to what is specified by `repository.*.ownerGroup` |
| Shawn O. Pearce | 897d921 | 2011-06-16 16:59:59 -0700 | [diff] [blame] | 76 | in gerrit.config. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 77 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 78 | --parent:: |
| 79 | -p:: |
| Shawn O. Pearce | 9c15114 | 2010-04-23 17:03:16 -0700 | [diff] [blame] | 80 | Name of the parent project to inherit access rights |
| 81 | through. If not specified, the parent is set to the default |
| Shawn O. Pearce | a063182 | 2011-06-14 11:18:18 -0700 | [diff] [blame] | 82 | project `All-Projects`. |
| Shawn O. Pearce | 9c15114 | 2010-04-23 17:03:16 -0700 | [diff] [blame] | 83 | |
| Bruce Zu | cdb3cb8 | 2011-12-14 13:27:43 +0800 | [diff] [blame] | 84 | --suggest-parents:: |
| 85 | -S:: |
| 86 | Suggest parent candidates. This option cannot be used with |
| 87 | other arguments. Print out a list of projects that are |
| 88 | already parents to other projects, thus it can help the user |
| 89 | find a suitable parent for the new project. |
| 90 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 91 | --permissions-only:: |
| Shawn O. Pearce | aaca959 | 2011-06-14 10:24:49 -0700 | [diff] [blame] | 92 | Create the project only to serve as a parent for other |
| 93 | projects. The new project's Git repository will be |
| 94 | initialized to have 'HEAD' point to 'refs/meta/config'. |
| 95 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 96 | --description:: |
| 97 | -d:: |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 98 | Initial description of the project. If not specified, |
| 99 | no description is stored. |
| Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 100 | + |
| 101 | Description values containing spaces should be quoted in single quotes |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 102 | ('). This most likely requires double quoting the value, for example |
| 103 | `--description "'A description string'"`. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 104 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 105 | --submit-type:: |
| 106 | -t:: |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 107 | Action used by Gerrit to submit an approved change to its |
| 108 | destination branch. Supported options are: |
| 109 | + |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 110 | * 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. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 114 | |
| 115 | + |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 116 | Defaults to MERGE_IF_NECESSARY. For more details see |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 117 | link:project-setup.html#submit_type[Change Submit Actions]. |
| 118 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 119 | --use-content-merge:: |
| Dmitry Fink | 876953e | 2010-09-29 23:44:22 -0700 | [diff] [blame] | 120 | If enabled, Gerrit will try to perform a 3-way merge of text |
| 121 | file content when a file has been modified by both the |
| 122 | destination branch and the change being submitted. This |
| 123 | option only takes effect if submit type is not |
| 124 | FAST_FORWARD_ONLY. Disabled by default. |
| 125 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 126 | --use-contributor-agreements:: |
| 127 | --ca:: |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 128 | If enabled, authors must complete a contributor agreement |
| 129 | on the site before pushing any commits or changes to this |
| 130 | project. Disabled by default. |
| 131 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 132 | --use-signed-off-by:: |
| 133 | --so: |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 134 | If enabled, each change must contain a Signed-off-by line |
| 135 | from either the author or the uploader in the commit message. |
| 136 | Disabled by default. |
| 137 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 138 | --require-change-id:: |
| 139 | --id:: |
| 140 | Require a valid link:user-changeid.html[Change-Id] footer |
| 141 | in any commit uploaded for review. This does not apply to |
| 142 | commits pushed directly to a branch or tag. |
| 143 | |
| 144 | --empty-commit:: |
| Shawn Pearce | ec15511 | 2010-10-12 13:58:36 +0200 | [diff] [blame] | 145 | Creates an initial empty commit for the Git repository of the |
| 146 | project that is newly created. |
| 147 | |
| Sasa Zivkov | a1ec941 | 2013-07-01 15:01:59 +0200 | [diff] [blame^] | 148 | --max-object-size-limit:: |
| 149 | Define maximum Git object size for this project. Pushes containing an |
| 150 | object larger than this limit will be rejected. This can be used to |
| 151 | further limit the global |
| 152 | link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit] |
| 153 | and cannot be used to increase that globally set limit. |
| 154 | + |
| 155 | Common unit suffixes of 'k', 'm', or 'g' are supported. |
| 156 | |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 157 | |
| 158 | EXAMPLES |
| 159 | -------- |
| 160 | Create a new project called `tools/gerrit`: |
| 161 | |
| 162 | ==== |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 163 | $ ssh -p 29418 review.example.com gerrit create-project tools/gerrit.git |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 164 | ==== |
| 165 | |
| Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 166 | Create a new project with a description: |
| 167 | |
| 168 | ==== |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 169 | $ ssh -p 29418 review.example.com gerrit create-project tool.git --description "'Tools used by build system'" |
| Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 170 | ==== |
| 171 | |
| 172 | Note that it is necessary to quote the description twice. The local |
| 173 | shell needs double quotes around the value to ensure the single quotes |
| 174 | are passed through SSH as-is to the remote Gerrit server, which uses |
| 175 | the single quotes to delimit the value. |
| 176 | |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 177 | REPLICATION |
| 178 | ----------- |
| Shawn O. Pearce | 7d2cb04 | 2012-05-10 19:12:09 -0700 | [diff] [blame] | 179 | If the replication plugin is installed, the plugin will attempt to |
| 180 | perform remote repository creation by a Bourne shell script: |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 181 | |
| 182 | ==== |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 183 | mkdir -p '/base/project.git' && cd '/base/project.git' && git init --bare && git update-ref HEAD refs/heads/master |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 184 | ==== |
| 185 | |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 186 | For this to work successfully the remote system must be able to run |
| 187 | arbitrary shell scripts, and must have `git` in the user's PATH |
| 188 | environment variable. Administrators could also run this command line |
| 189 | by hand to establish a new empty repository. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 190 | |
| Shawn O. Pearce | 7d2cb04 | 2012-05-10 19:12:09 -0700 | [diff] [blame] | 191 | A custom extension or plugin may also be developed to implement the |
| 192 | NewProjectCreatedListener extension point and handle custom logic |
| 193 | for remote repository creation. |
| 194 | |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 195 | SEE ALSO |
| 196 | -------- |
| 197 | |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 198 | * link:project-setup.html[Project Setup] |
| 199 | |
| 200 | GERRIT |
| 201 | ------ |
| 202 | Part of link:index.html[Gerrit Code Review] |