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