| 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>] |
| 17 | [--submit-type <TYPE> | -t <TYPE>] |
| 18 | [--use-contributor-agreements | --ca] |
| 19 | [--use-signed-off-by | --so] |
| 20 | [--use-content-merge] |
| 21 | [--require-change-id | --id] |
| 22 | [--branch <REF> | -b <REF>] |
| 23 | [--empty-commit] |
| 24 | { <NAME> | --name <NAME> } |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 25 | |
| 26 | DESCRIPTION |
| 27 | ----------- |
| 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 | |
| 39 | ACCESS |
| 40 | ------ |
| Shawn O. Pearce | 897d921 | 2011-06-16 16:59:59 -0700 | [diff] [blame] | 41 | Caller must be a member of the privileged 'Administrators' group, |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame^] | 42 | or have been granted |
| 43 | link:access-control.html#capability_createProject[the 'Create Project' global capability]. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 44 | |
| 45 | SCRIPTING |
| 46 | --------- |
| 47 | This command is intended to be used in scripts. |
| 48 | |
| 49 | OPTIONS |
| 50 | ------- |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 51 | <NAME>:: |
| 52 | Required; name of the new project to create. If name ends |
| 53 | with `.git` the suffix will be automatically removed. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 54 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 55 | --name:: |
| 56 | -n:: |
| 57 | Deprecated alias for the <NAME> argument. This option may |
| 58 | be removed in a future release. |
| 59 | |
| 60 | --branch:: |
| 61 | -b:: |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 62 | Name of the initial branch in the newly created project. |
| 63 | Defaults to 'master'. |
| 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. |
| 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 | + |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 112 | Defaults to MERGE_IF_NECESSARY. For more details see |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 113 | link:project-setup.html#submit_type[Change Submit Actions]. |
| 114 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 115 | --use-content-merge:: |
| Dmitry Fink | 876953e | 2010-09-29 23:44:22 -0700 | [diff] [blame] | 116 | If enabled, Gerrit will try to perform a 3-way merge of text |
| 117 | file content when a file has been modified by both the |
| 118 | destination branch and the change being submitted. This |
| 119 | option only takes effect if submit type is not |
| 120 | FAST_FORWARD_ONLY. Disabled by default. |
| 121 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 122 | --use-contributor-agreements:: |
| 123 | --ca:: |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 124 | If enabled, authors must complete a contributor agreement |
| 125 | on the site before pushing any commits or changes to this |
| 126 | project. Disabled by default. |
| 127 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 128 | --use-signed-off-by:: |
| 129 | --so: |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 130 | If enabled, each change must contain a Signed-off-by line |
| 131 | from either the author or the uploader in the commit message. |
| 132 | Disabled by default. |
| 133 | |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 134 | --require-change-id:: |
| 135 | --id:: |
| 136 | Require a valid link:user-changeid.html[Change-Id] footer |
| 137 | in any commit uploaded for review. This does not apply to |
| 138 | commits pushed directly to a branch or tag. |
| 139 | |
| 140 | --empty-commit:: |
| Shawn Pearce | ec15511 | 2010-10-12 13:58:36 +0200 | [diff] [blame] | 141 | Creates an initial empty commit for the Git repository of the |
| 142 | project that is newly created. |
| 143 | |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 144 | |
| 145 | EXAMPLES |
| 146 | -------- |
| 147 | Create a new project called `tools/gerrit`: |
| 148 | |
| 149 | ==== |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 150 | $ 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] | 151 | ==== |
| 152 | |
| Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 153 | Create a new project with a description: |
| 154 | |
| 155 | ==== |
| Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 156 | $ 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] | 157 | ==== |
| 158 | |
| 159 | Note that it is necessary to quote the description twice. The local |
| 160 | shell needs double quotes around the value to ensure the single quotes |
| 161 | are passed through SSH as-is to the remote Gerrit server, which uses |
| 162 | the single quotes to delimit the value. |
| 163 | |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 164 | REPLICATION |
| 165 | ----------- |
| 166 | The remote repository creation is performed by a Bourne shell script: |
| 167 | |
| 168 | ==== |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 169 | 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] | 170 | ==== |
| 171 | |
| Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 172 | For this to work successfully the remote system must be able to run |
| 173 | arbitrary shell scripts, and must have `git` in the user's PATH |
| 174 | environment variable. Administrators could also run this command line |
| 175 | by hand to establish a new empty repository. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 176 | |
| 177 | SEE ALSO |
| 178 | -------- |
| 179 | |
| 180 | * link:config-replication.html[Git Replication/Mirroring] |
| 181 | * link:project-setup.html[Project Setup] |
| 182 | |
| 183 | GERRIT |
| 184 | ------ |
| 185 | Part of link:index.html[Gerrit Code Review] |