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> ] |
| 14 | [--permissions-only] |
| 15 | [--description <DESC> | -d <DESC>] |
| 16 | [--submit-type <TYPE> | -t <TYPE>] |
| 17 | [--use-contributor-agreements | --ca] |
| 18 | [--use-signed-off-by | --so] |
| 19 | [--use-content-merge] |
| 20 | [--require-change-id | --id] |
| 21 | [--branch <REF> | -b <REF>] |
| 22 | [--empty-commit] |
| 23 | { <NAME> | --name <NAME> } |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 24 | |
| 25 | DESCRIPTION |
| 26 | ----------- |
| 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 | |
| 38 | ACCESS |
| 39 | ------ |
Shawn O. Pearce | 897d921 | 2011-06-16 16:59:59 -0700 | [diff] [blame^] | 40 | Caller must be a member of the privileged 'Administrators' group, |
| 41 | or have been granted the 'Create Project' global capability. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 42 | |
| 43 | SCRIPTING |
| 44 | --------- |
| 45 | This command is intended to be used in scripts. |
| 46 | |
| 47 | OPTIONS |
| 48 | ------- |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 49 | <NAME>:: |
| 50 | Required; name of the new project to create. If name ends |
| 51 | with `.git` the suffix will be automatically removed. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 52 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 53 | --name:: |
| 54 | -n:: |
| 55 | Deprecated alias for the <NAME> argument. This option may |
| 56 | be removed in a future release. |
| 57 | |
| 58 | --branch:: |
| 59 | -b:: |
Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 60 | Name of the initial branch in the newly created project. |
| 61 | Defaults to 'master'. |
| 62 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 63 | --owner:: |
| 64 | -o:: |
Hugo Josefson | 072b470 | 2010-04-21 19:27:11 +0200 | [diff] [blame] | 65 | Name of the group(s) which will initially own this repository. |
| 66 | The specified group(s) must already be defined within Gerrit. |
| 67 | Several groups can be specified on the command line. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 68 | + |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 69 | Defaults to what is specified by `repository.*.ownerGroup` |
Shawn O. Pearce | 897d921 | 2011-06-16 16:59:59 -0700 | [diff] [blame^] | 70 | in gerrit.config. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 71 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 72 | --parent:: |
| 73 | -p:: |
Shawn O. Pearce | 9c15114 | 2010-04-23 17:03:16 -0700 | [diff] [blame] | 74 | Name of the parent project to inherit access rights |
| 75 | through. If not specified, the parent is set to the default |
Shawn O. Pearce | a063182 | 2011-06-14 11:18:18 -0700 | [diff] [blame] | 76 | project `All-Projects`. |
Shawn O. Pearce | 9c15114 | 2010-04-23 17:03:16 -0700 | [diff] [blame] | 77 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 78 | --permissions-only:: |
Shawn O. Pearce | aaca959 | 2011-06-14 10:24:49 -0700 | [diff] [blame] | 79 | Create the project only to serve as a parent for other |
| 80 | projects. The new project's Git repository will be |
| 81 | initialized to have 'HEAD' point to 'refs/meta/config'. |
| 82 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 83 | --description:: |
| 84 | -d:: |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 85 | Initial description of the project. If not specified, |
| 86 | no description is stored. |
Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 87 | + |
| 88 | Description values containing spaces should be quoted in single quotes |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 89 | ('). This most likely requires double quoting the value, for example |
| 90 | `--description "'A description string'"`. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 91 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 92 | --submit-type:: |
| 93 | -t:: |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 94 | Action used by Gerrit to submit an approved change to its |
| 95 | destination branch. Supported options are: |
| 96 | + |
Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 97 | * FAST_FORWARD_ONLY: produces a strictly linear history. |
| 98 | * MERGE_IF_NECESSARY: create a merge commit when required. |
| 99 | * MERGE_ALWAYS: always create a merge commit. |
| 100 | * CHERRY_PICK: always cherry-pick the commit. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 101 | |
| 102 | + |
Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 103 | Defaults to MERGE_IF_NECESSARY. For more details see |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 104 | link:project-setup.html#submit_type[Change Submit Actions]. |
| 105 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 106 | --use-content-merge:: |
Dmitry Fink | 876953e | 2010-09-29 23:44:22 -0700 | [diff] [blame] | 107 | If enabled, Gerrit will try to perform a 3-way merge of text |
| 108 | file content when a file has been modified by both the |
| 109 | destination branch and the change being submitted. This |
| 110 | option only takes effect if submit type is not |
| 111 | FAST_FORWARD_ONLY. Disabled by default. |
| 112 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 113 | --use-contributor-agreements:: |
| 114 | --ca:: |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 115 | If enabled, authors must complete a contributor agreement |
| 116 | on the site before pushing any commits or changes to this |
| 117 | project. Disabled by default. |
| 118 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 119 | --use-signed-off-by:: |
| 120 | --so: |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 121 | If enabled, each change must contain a Signed-off-by line |
| 122 | from either the author or the uploader in the commit message. |
| 123 | Disabled by default. |
| 124 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 125 | --require-change-id:: |
| 126 | --id:: |
| 127 | Require a valid link:user-changeid.html[Change-Id] footer |
| 128 | in any commit uploaded for review. This does not apply to |
| 129 | commits pushed directly to a branch or tag. |
| 130 | |
| 131 | --empty-commit:: |
Shawn Pearce | ec15511 | 2010-10-12 13:58:36 +0200 | [diff] [blame] | 132 | Creates an initial empty commit for the Git repository of the |
| 133 | project that is newly created. |
| 134 | |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 135 | |
| 136 | EXAMPLES |
| 137 | -------- |
| 138 | Create a new project called `tools/gerrit`: |
| 139 | |
| 140 | ==== |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 141 | $ 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] | 142 | ==== |
| 143 | |
Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 144 | Create a new project with a description: |
| 145 | |
| 146 | ==== |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 147 | $ 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] | 148 | ==== |
| 149 | |
| 150 | Note that it is necessary to quote the description twice. The local |
| 151 | shell needs double quotes around the value to ensure the single quotes |
| 152 | are passed through SSH as-is to the remote Gerrit server, which uses |
| 153 | the single quotes to delimit the value. |
| 154 | |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 155 | REPLICATION |
| 156 | ----------- |
| 157 | The remote repository creation is performed by a Bourne shell script: |
| 158 | |
| 159 | ==== |
Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 160 | 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] | 161 | ==== |
| 162 | |
Shawn O. Pearce | 8c56a8c | 2009-09-18 19:21:08 -0700 | [diff] [blame] | 163 | For this to work successfully the remote system must be able to run |
| 164 | arbitrary shell scripts, and must have `git` in the user's PATH |
| 165 | environment variable. Administrators could also run this command line |
| 166 | by hand to establish a new empty repository. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 167 | |
| 168 | SEE ALSO |
| 169 | -------- |
| 170 | |
| 171 | * link:config-replication.html[Git Replication/Mirroring] |
| 172 | * link:project-setup.html[Project Setup] |
| 173 | |
| 174 | GERRIT |
| 175 | ------ |
| 176 | Part of link:index.html[Gerrit Code Review] |