| Gerrit2 - Project Configuration |
| =============================== |
| |
| All Git repositories under `site_path` must be registered in the |
| Gerrit database in order to be accessed through SSH, or through |
| the web interface. |
| |
| Create Git Repository |
| --------------------- |
| |
| Create a Git repository under `git_base_path`: |
| |
| ==== |
| git --git-dir=$git_base_pathgit/new/project.git init |
| ==== |
| |
| [TIP] |
| By tradition the project name should have a `.git` suffix. |
| |
| To also make this repository available over the anonymous git:// |
| protocol, don't forget the git-daemon-export-ok file: |
| |
| ==== |
| touch $git_base_pathgit/new/project.git/git-daemon-export-ok |
| ==== |
| |
| Register Project |
| ---------------- |
| |
| At least two inserts are needed to register a project with Gerrit: |
| one to define the project exists, and another to define a branch |
| that changes can be uploaded to. Additional branches may be |
| defined if desired. |
| |
| [NOTE] |
| Note that the `.git` suffix is not typically included in the |
| project name, as it looks cleaner in the web when not shown. |
| Gerrit automatically assumes that `project.git` is the Git repository |
| for a project named `project`. |
| |
| ==== |
| psql reviewdb |
| INSERT INTO projects |
| (project_id |
| ,use_contributor_agreements |
| ,owner_group_id |
| ,name) |
| VALUES |
| (nextval('project_id') |
| ,'Y' |
| ,(SELECT admin_group_id FROM system_config) |
| ,'new/project'); |
| |
| INSERT INTO branches |
| (branch_id |
| ,branch_name |
| ,project_name) |
| VALUES |
| (nextval('branch_id') |
| ,'refs/heads/master' |
| ,'new/project'); |
| ==== |
| |
| Registering Additional Branches |
| ------------------------------- |
| |
| Branches can be created over the SSH port by any `git push` client, |
| if the user has been granted the `Push Branch` > `Create Branch` |
| (or higher) access right. |
| |
| Additional branches can also be created through the web UI, assuming |
| at least one commit already exists in the project repository. |
| A project owner can create additional branches under `Admin` > |
| `Projects` > `Branches`. Enter the new branch name, and the |
| starting Git revision. Branch names that don't start with `refs/` |
| will automatically have `refs/heads/` prefixed to ensure they are |
| a standard Git branch name. Almost any valid SHA-1 expression can |
| be used to specify the starting revision, so long as it resolves |
| to a commit object. Abbreviated SHA-1s are not supported. |