Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - Project Configuration |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 2 | |
Edwin Kempin | f2b47e2 | 2014-04-24 13:00:28 +0200 | [diff] [blame] | 3 | [[project-creation]] |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 4 | == Project Creation |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 5 | |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 6 | There are several ways to create a new project in Gerrit: |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 7 | |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 8 | - in the Web UI under 'Projects' > 'Create Project' |
| 9 | - via the link:rest-api-projects.html#create-project[Create Project] |
| 10 | REST endpoint |
| 11 | - via the link:cmd-create-project.html[create-project] SSH command |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 12 | |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 13 | To be able to create new projects the global capability |
| 14 | link:access-control.html#capability_createProject[Create Project] must |
| 15 | be granted. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 16 | |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 17 | In addition, projects can be created link:#manual_project_creation[ |
| 18 | manually]. |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 19 | |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 20 | [[manual_project_creation]] |
| 21 | === Manual Project Creation |
Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 22 | |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 23 | . Create a Git repository under `gerrit.basePath`: |
| 24 | + |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 25 | ---- |
Shawn O. Pearce | 9743d0b | 2009-06-01 10:10:06 -0700 | [diff] [blame] | 26 | git --git-dir=$base_path/new/project.git init |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 27 | ---- |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 28 | + |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 29 | [TIP] |
Shawn O. Pearce | 5596823 | 2009-05-08 10:23:27 -0700 | [diff] [blame] | 30 | By tradition the repository directory name should have a `.git` |
| 31 | suffix. |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 32 | + |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 33 | To also make this repository available over the anonymous git:// |
Shawn O. Pearce | 5596823 | 2009-05-08 10:23:27 -0700 | [diff] [blame] | 34 | protocol, don't forget to create a `git-daemon-export-ok` file: |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 35 | + |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 36 | ---- |
Shawn O. Pearce | 9743d0b | 2009-06-01 10:10:06 -0700 | [diff] [blame] | 37 | touch $base_path/new/project.git/git-daemon-export-ok |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 38 | ---- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 39 | |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 40 | . Register Project |
| 41 | + |
Shawn O. Pearce | c756ecf | 2011-06-20 18:49:57 -0700 | [diff] [blame] | 42 | Either restart the server, or flush the `project_list` cache: |
Edwin Kempin | 53ae7d2 | 2014-04-17 12:53:16 +0200 | [diff] [blame] | 43 | + |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 44 | ---- |
Shawn O. Pearce | c756ecf | 2011-06-20 18:49:57 -0700 | [diff] [blame] | 45 | ssh -p 29418 localhost gerrit flush-caches --cache project_list |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 46 | ---- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 47 | |
Edwin Kempin | 7036391 | 2014-04-17 16:53:38 +0200 | [diff] [blame] | 48 | [[project_options]] |
| 49 | == Project Options |
| 50 | |
Changcheng Xiao | 5ecb642 | 2019-01-15 17:17:04 +0100 | [diff] [blame] | 51 | See details at link:config-project-config.html#project-section[project section]. |
Edwin Kempin | 7036391 | 2014-04-17 16:53:38 +0200 | [diff] [blame] | 52 | |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 53 | [[branch-admin]] |
| 54 | == Branch Administration |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 55 | |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 56 | [[branch-creation]] |
| 57 | === Branch Creation |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 58 | |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 59 | There are several ways to create a new branch in a project: |
| 60 | |
| 61 | - in the Web UI under 'Projects' > 'List' > <project> > 'Branches' |
| 62 | - via the link:rest-api-projects.html#create-branch[Create Branch] |
| 63 | REST endpoint |
| 64 | - via the link:cmd-create-branch.html[create-branch] SSH command |
| 65 | - by using a git client to push a commit to a non-existing branch |
| 66 | |
| 67 | To be able to create new branches the user must have the |
| 68 | link:access-control.html#category_create[Create Reference] access |
Hugo Arès | 5187d67 | 2018-03-19 13:04:01 -0400 | [diff] [blame] | 69 | right. |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 70 | |
David Pursehouse | a1d633b | 2014-05-02 17:21:02 +0900 | [diff] [blame] | 71 | When using the Web UI, the REST endpoint or the SSH command it is only |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 72 | possible to create branches on commits that already exist in the |
| 73 | repository. |
| 74 | |
| 75 | If a branch name does not start with `refs/` it is automatically |
| 76 | prefixed with `refs/heads/`. |
| 77 | |
| 78 | The starting revision for a new branch can be any valid SHA-1 |
| 79 | expression, as long as it resolves to a commit. Abbreviated SHA-1s |
| 80 | are not supported. |
| 81 | |
| 82 | [[branch-deletion]] |
| 83 | === Branch Deletion |
| 84 | |
| 85 | There are several ways to delete a branch: |
| 86 | |
| 87 | - in the Web UI under 'Projects' > 'List' > <project> > 'Branches' |
| 88 | - via the link:rest-api-projects.html#delete-branch[Delete Branch] |
| 89 | REST endpoint |
Gert van Dijk | 8c5e33c | 2017-10-19 22:38:06 +0200 | [diff] [blame] | 90 | - by using a git client |
| 91 | + |
| 92 | ---- |
| 93 | $ git push origin --delete refs/heads/<branch-to-delete> |
| 94 | ---- |
| 95 | + |
| 96 | another method, by force pushing nothing to an existing branch: |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 97 | + |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 98 | ---- |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 99 | $ git push --force origin :refs/heads/<branch-to-delete> |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 100 | ---- |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 101 | |
| 102 | To be able to delete branches, the user must have the |
Gert van Dijk | 8c5e33c | 2017-10-19 22:38:06 +0200 | [diff] [blame] | 103 | link:access-control.html#category_delete[Delete Reference] or the |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 104 | link:access-control.html#category_push[Push] access right with the |
Hugo Arès | 5187d67 | 2018-03-19 13:04:01 -0400 | [diff] [blame] | 105 | `force` option. |
Edwin Kempin | 34f4f88 | 2014-04-22 16:13:18 +0200 | [diff] [blame] | 106 | |
| 107 | [[default-branch]] |
| 108 | === Default Branch |
| 109 | |
| 110 | The default branch of a remote repository is defined by its `HEAD`. |
| 111 | For convenience reasons, when the repository is cloned Git creates a |
| 112 | local branch for this default branch and checks it out. |
| 113 | |
| 114 | Project owners can set `HEAD` |
| 115 | |
| 116 | - in the Web UI under 'Projects' > 'List' > <project> > 'Branches' or |
| 117 | - via the link:rest-api-projects.html#set-head[Set HEAD] REST endpoint |
| 118 | |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 119 | |
| 120 | GERRIT |
| 121 | ------ |
| 122 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 123 | |
| 124 | SEARCHBOX |
| 125 | --------- |