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