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