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