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.
Creating an Empty Git Repository
-
Click + New Repository.
-
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.
-
In Initial Content, select the Empty Repository option.
-
Click Create.
Creating a Git Repository Initialized with a ReadMe File
-
Click + New Repository.
-
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.
-
In Initial Content, select the Initialize repository with README file option.
-
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.
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.
Editing Git Repository’s Description
You can edit a Git repository’s description from the Project Settings: Repositories page, but cannot change its name.
- In the navigation bar, click Project Settings.
- Click Repositories.
- Mouse over the Git repository name.
- From the Options
menu, select Edit.
- In the Description field of the Edit Repository dialog, enter or edit the repository description.
- Click Update
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.
- In the navigation bar, click Project Settings.
- Click Repositories.
- Mouse over the repository name.
- From the Options
menu, select Edit.
- 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.
- Click Update.
Indexing a Git Repository
Indexing a Git repository creates or updates the Git repository index file with the latest changes.
- In the navigation bar, click Project Settings.
- Click Repositories.
- Mouse over the repository name you want to index.
- From the Options
menu, select Index.
Deleting a Git Repository
You can delete a Git repository from the Project Settings: Repositories page.
- In the navigation bar, click Project Settings.
- Click Repositories.
- Mouse over the repository name you want to delete.
- From the Options
menu, select Delete.
- 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 edit the registry, mouse over the registry name. On the right side, from the 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, 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:
-
In the navigation bar, click Project Settings.
-
Click Repositories.
-
In Maven Repository, if necessary, expand Configure auto cleanup for Snapshot versions.
-
Select the Purge check box.
-
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:
-
In the Maven Repository section of the Repositories page, select the Purge check box and configure the default auto-cleanup as described above.
-
To add an artifact group or an artifact name as an exception, click + Add in the Customized Snapshot Counts section.
-
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 . 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 messageUnable 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.
-
In the navigation bar, click Project Settings.
-
Click Repositories.
-
In Maven Repository, expand Configure Overwrite Property for Release Artifacts.
-
Select the Allow check box.