Add or Edit a Git Repository Rule

By default, all hosted and external Git repositories rules are enabled.

You can edit the default rules and add new Git Repository rules if you added Git repositories to the project after the template was defined. You can also add a rule to make a copy of an existing Git repository on the new project that uses the template. If you don't want a Git repository to be included in the template, remove its rule.

Here's how to add or edit hosted and external Git repository rules:

Action How To

Add or edit a hosted Git repository rule

  1. On the Properties page, in the Template section, click Edit.

  2. In the Rules section, to add the rule, click Add Rule. From the menu, select Git Repository.

    To edit an existing rule, to the right side of the Git repository rule, click Edit Edit.

  3. In Source Repository, specify the name of the Git repository to be copied.

  4. In Repository Name, specify the new name of the Git repository. A .git extension is automatically added if you missed it.

    To use the new project name as the name of the Git repository, select the Use target project name check box.

    To allow a user creating a project from the template to change the default Git repository name, select the Override name on create check box.

  5. If necessary, in Replacements, define file name replacements of the Git repository matching the specified criterion. This is useful if you want to make a copy of an existing Git repository.

    To add a new replacement rule, click Add new replacement.

    1. From the In drop-down list, select the files where the replacements apply.

      You can specify all files, files matching an Ant pattern, or a specific file.

    2. In Replace, specify the search term.

    3. In With, specify the replacement term.

      You can select a pre-defined variable such as Project Id, Project Name, Project URL Name, or Repository Name. To use a variable defined in the Variables section, select Variable and then select the variable name.

    4. Click Save Save.

    When you create a project using this template, the project creation wizard searches through the specified files in the Git repository and replaces the term with the specified value of the selected variables.

  6. Click Save Save to save the Git repository rule.

  7. Click Save to save the project template.

Add or edit an external Git repository rule

  1. On the Properties page, in the Template section, click Edit.

  2. In the Rules section, to add the rule, click Add Rule. From the menu, select External Repository.

    To edit an existing rule, to the right side of the Git repository rule, click Edit Edit.

  3. In Repository URL, enter the external Git repository URL. To update a rule, enter a new URL.

  4. In Username and Password, enter credentials to access the external Git repository.

    For public Git repositories, don’t fill these fields.

  5. In Repository Name, specify the new name of the Git repository. A .git extension is automatically added if you missed it.

    To use the new project name as the name of the Git repository, select the Use target project name check box.

    To allow the user that creates the project from the template to change the default Git repository name, select the Override name on create check box.

  6. Click Save Save to save the Git repository rule.

  7. Click Save to save the project template.