Managing Repositories

When a project is created, you can choose to initialize the project with one project Git repository for the project. A Maven repository is also created. If required, you can add more project Git repositories, add external Git repositories, import Git repositories, configure auto-cleanup of the to the project Maven repository, and add Docker registry links.

From the Repositories page, you can manage Git repositories, link external Docker registries, and configure auto–cleanup of Maven repository.

Creating a Hosted Git Repository

You can add multiple hosted Git repositories to your project. A hosted Git repository is also called as a project Git repository. You can create a Git repository from the Repositories tab of the Project Home page, Git page, and from the Project Settings: Repositories page.

You can create an empty Git repository, a Git repository with a readme file, or import files from another Git repository.

Creating an Empty Git Repository

  1. Click + New Repository.

  2. In the New Repository dialog box, in Name and Description, enter a unique name and a description.

    Ensure that the repository name begins with a letter or a number, and does not contain special characters or spaces.

  3. In Initial Content, select the Empty Repository option.

  4. Click Create.

Creating a Git Repository Initialized with a ReadMe File

  1. Click + New Repository.

  2. In the New Repository dialog box, in Name and Description, enter a unique name and a description.

    Ensure that the repository name begins with a letter or a number, and does not contain special characters or spaces.

  3. In Initial Content, select the Initialize repository with README file option.

  4. Click Create.

Importing a Git Repository

You can import an external Git repository while creating a project Git repository. An external Git repository is a Git repository that is not available in your project. It could be a Git repository of another project, or a Git repository available on another platform such as GitHub or Bitbucket.

When you import an external Git repository, you import its branches, tags, and commit history. Any changes made to the external Git repository after the import is successful are not reflected in the imported Git repository.
To import a Git repository:
  1. On the Project Home: Repositories tab or the Project Settings: Repositories page, click + New Git Repository (or + Hosted Git Repository).
  2. In the New Repository dialog box, in Initial content, select Import existing repository.
  3. In the text box, enter the URL of in the external Git repository.
    If the imported Git repository is password protected, enter the repository credentials in Username and Password. Note that Oracle Developer Cloud Service does not store the credentials.
  4. Click Create.
You can also import an existing Git repository to an empty project Git repository from the Code page. If the added hosted Git repository is empty, enter the Git repository’s URL in the Import existing repository section of the Git page. Enter repository credentials, if required, and click Import.

Adding an External Git Repository

You can add an external Git repository to your project. An external Git repository is a Git repository that is not available in your project. It could be a Git repository of another project, or a Git repository available on another platform such as GitHub or Bitbucket.

When you add an external Git repository, you do not create a Git repository in your project, but create a link to it from your project. Any changes made to the external Git repository are immediately visible in the project.

Watch a short video to learn more about using an external Git repository in Oracle Developer Cloud Service.

To add an external Git repository in your project:
  1. In the navigation bar, click Project Settings.
  2. Click Repositories.
  3. Under External Repositories, click New Repository.
  4. In the New Repository dialog, enter the URL of the external Git repository in URL and the repository description in Description.
  5. Expand the Credentials for non-public repos section and provide the credentials to access the external Git repository.

    You should create an authentication token such as GitHub's personal access token or BitBucket's App Password and use it to provide access to the external Git repository. Do not provide the password of your account.

    In Username, enter the username of the external repository account. In Token, enter the authentication token.

  6. Click Create.

Editing Git Repository’s Description

You can edit a Git repository’s description from the Project Settings: Repositories page, but cannot change its name.

To edit the description of a Git repository:
  1. In the navigation bar, click Project Settings.
  2. Click Repositories.
  3. Mouse over the Git repository name.
  4. From the Options Options menu, select Edit.
  5. In the Description field of the Edit Repository dialog, enter or edit the repository description.
  6. Click Update
You can also update a Git repository’s description from the Code page. In the Code page, select Description from the list and edit the repository description.

Setting the Default Branch of a Git Repository

By default, the master branch of a Git repository is the default branch. However, you can set any branch as the default branch of a Git repository.

When you open a Git repository in the Code page, the contents of the default branch will be displayed.
To set the default branch of a Git repository:
  1. In the navigation bar, click Project Settings.
  2. Click Repositories.
  3. Mouse over the repository name.
  4. From the Options Options menu, select Edit.
  5. In the Default Branch drop-down list of the Edit Repository dialog box, select the branch that you want to set as the default branch.
  6. Click Update.

Indexing a Git Repository

Indexing a Git repository creates or updates the Git repository index file with the latest changes.

A Git index file is a binary file that serves as a virtual staging area for the next commit and contains a sorted list of object path names, along with permissions and the SHA-1 of a blob object.
To index a Git repository:
  1. In the navigation bar, click Project Settings.
  2. Click Repositories.
  3. Mouse over the repository name you want to index.
  4. From the Options Options menu, select Index.

Deleting a Git Repository

You can delete a Git repository from the Project Settings: Repositories page.

To delete a Git repository:
  1. In the navigation bar, click Project Settings.
  2. Click Repositories.
  3. Mouse over the repository name you want to delete.
  4. From the Options Options menu, select Delete.
  5. In the Remove Repository dialog box, click Yes.

Adding a Link to an External Docker Registry

You can link external docker registries to a project and view the contents of the Docker registry in the Docker Registry page of the project. After linking an external Docker registry, you need not leave the project to view its contents.

To add a link to an external Docker registry:
  1. In the navigation bar, click Project Settings.
  2. Click Repositories.
  3. In Docker Registries, click + Link External Registry.
    To view all linked Docker registries, expand Linked External Docker Registries.
  4. In the Link External Docker Registry dialog box, complete the elements using the descriptions in the table.
    Element Description

    Registry Name

    Enter a unique Docker registry name. The name must be unique in the Linked External Docker Registries section.

    Registry URL

    Enter the URL of the Docker registry. For example: https://registry-1.docker.io.

    Short Description

    Enter a short description of the registry.

    Authentication

    Select the authentication method to connect to the registry. By default, Basic is selected.

    • Basic: Enter the basic username and password details in Username and Password.

    • OAuth2: Enter the long-lived access token as the authentication in Auth Token. Do not enter a short-lived access token.

      For more information about OAuth2 in Docker, see https://docs.docker.com/registry/spec/auth/oauth/.

    • Anonymous: Use this option if the registry can be accessed anonymously and does not require any authentication.

  5. Click Create.
The dialog tests the access to the registry and adds it to the Linked External Docker Registries section after the access is successful. You can access the registry and other linked registries from the Docker Registry page.

To edit the registry, mouse over the registry name. On the right side, from the Menu Menu menu, click Edit. Edit the details in the Edit External Docker Registry dialog box and click Update.

To remove the registry, mouse over the registry name. On the right side, from the Menu Menu menu, click Remove. In the Remove docker Registry dialog box, click Remove.

Configuring Auto-Cleanup and Overwrite Artifacts Properties of the Project Maven Repository

You can configure the project Maven repository to clean-up and purge old versions of artifact snapshots when a new version is uploaded to the repository, or overwrite an artifact with same groupID, artifactID, and version details.

Configure Auto-Cleanup

By default, when you upload a new snapshot of an artifact to the project Maven repository manually or via job builds, the repository retains the old versions of the snapshots. You can configure the project to remove the old versions when a new version is uploaded.

To remove older versions of snapshots automatically when a new version is uploaded:

  1. In the navigation bar, click Project Settings.

  2. Click Repositories.

  3. In Maven Repository, if necessary, expand Configure auto cleanup for Snapshot versions.

  4. Select the Purge check box.

  5. In Default Max Snapshots, enter a number between 2 and 500 to specify the maximum versions to retain. By default, 2 versions of the snapshots are retained.

All changes are saved automatically when you navigate to another field. After the rule is enabled, any new upload of a snapshot will remove its older versions if the number of snapshots exceed the value in Default Max Snapshots.

You can also add exceptions to the auto-cleanup and Default Max Snapshots rule and customize the snapshot counts. The project Maven repository will retain the snapshot counts of group IDs and artifacts defined in the Customized Snapshot Counts section and will use the default value specified in Default Max Snapshots for artifacts that do not have exceptions defined.

To define exceptions and customize snapshot count:

  1. In the Maven Repository section of the Repositories page, select the Purge check box and configure the default auto-cleanup as described above.

  2. To add an artifact group or an artifact name as an exception, click + Add in the Customized Snapshot Counts section.

  3. Specify the following details:

    • Group Id (Required): Enter or select the Group ID of the artifact. You can select the ID from the list or start typing and then select the ID from the list of suggestions. The auto-suggest list is based on the Maven indexes. If no index data is available, the auto-suggest list will not appear.

    • Artifact Id (Optional): Enter or select the Artifact ID of the artifact. You can select the ID from the list or start typing and then select the ID from the list of suggestions. The auto-suggest list is based on the Maven indexes. If no index data is available, the auto-suggest list will not appear.

    • Snapshot Count: Select the number of snapshots to retain in the project Maven repository. By default, 2 snapshots are retained.

To remove an exception, on the right, click Remove Remove. For a long list of exceptions, you can use the Filter field and enter a search coordinates criteria to see the exceptions matching the criteria.

Note:

If you enter an exception with duplicate coordinates, an error message Unable to save. Coordinates already exists. Enter unique coordinates appears.

Configure Overwrite for Artifacts

By default, when a user tries to upload a Maven release artifact with the same groupID, artifactID, and version values of an existing artifact to the project’s Maven repository, the upload fails. If a build tries to upload an artifact with duplicate groupID, artifactID, and version values, it fails too. To allow the duplicate artifact to be uploaded, you can configure the project’s Maven repository to allow the build to upload artifacts with duplicate groupID, artifactID, and version values.

  1. In the navigation bar, click Project Settings.

  2. Click Repositories.

  3. In Maven Repository, expand Configure Overwrite Property for Release Artifacts.

  4. Select the Allow check box.