Creating a Repository

Learn how to create a code repository in the DevOps service.

Required IAM Policy

Each service in Oracle Cloud Infrastructure (OCI) integrates with Identity and Access Management (IAM) for authentication and authorization. To grant users permission to access the DevOps code repositories and other resources, you have to create dynamic groups and IAM policies.

For creating dynamic groups and policies for code repositories, see Code Repository Policies. For more details, see DevOps IAM Policies.

An authentication (auth) token is required for each user who uses Git to interact with the code repositories in Oracle Cloud.

For accessing DevOps using the Oracle Cloud Console, REST API, and CLI, see Accessing DevOps.

Using the Console

Before you create a code repository, you must have a DevOps project.
  1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
  2. Select a project and click Code Repositories on the left-side menu.
  3. Click Create Repository.
  4. Enter a name and optional description for the repository.
  5. (Optional) Enter a default branch name.
    If the value is not provided, then the branch is named as "main".
  6. (Optional) To add tags to the repository, click Show tagging options.

    Tagging is a metadata system that lets you organize and track the resources in your tenancy.

    If you have permissions to create a resource, you also have permissions to add free-form tags to it.

    To add a defined tag, you must have permissions to use the tag namespace.

    For more information, see Resource Tags.

  7. Click Create Repository.
    An empty code repository is created on the main branch.
To access your code repository:
  1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
  2. Select a project and click Code Repositories on the left-side menu.
  3. Select a code repository.
  4. You can perform the following actions on the repository, as needed. These options are available in the left-side menu of the repository details page:
    • To view and access all the files and folders in your repository, click Files. Last commit and update details are also available.
    • To view and access all the commits pertaining to the code repository, click Commit. Details such as commit date and author are provided. You can filter the commits by author and date. Each commit is assigned a unique ID, which you can use to track the changes.
    • To compare file changes and commit changes between any two branches in your repository, click Compare. Choose a source and target branch to compare.
    • To view and access all the available branches in your repository, click Branches.
    • To view the various tags that point to specific points in the commits, click Git Tags.
    • To monitor the status of all the operations in progress, click Work Requests.

To clone your code repository, see Cloning a Repository.

Using the CLI

To create a code repository, run the create command:

oci devops repository create --name --project-id --repository-type

To view a list of repositories, run the list command:

oci devops repository list --compartment-id or --project-id

To view a list of commits, run the list-commits command:

oci devops repository list-commits --repository-id

To get all the commands for repository:

oci devops repository -h

Using the API

To create a code repository, use the CreateRepository operation.

To view a list of commits to the repository, use the ListCommits operation.

To view a list of repositories, use the ListRepositories operation.