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