Skip to main content

Get Started

Last updated on

This guide walks you through the essential steps to start using the Harness Code Repository module. You set up repositories, work with your code, connect repositories to pipelines, and configure access and security.

If you are new to Harness, go to Get started with Harness Platform to create an account before you onboard to Code. Go to Overview and key concepts to review core SCM concepts and how Harness Code integrates with the Harness Platform.


What you will learn

  • Set up repositories: Create, import, or mirror repositories into Harness Code.
  • Work in repositories: Clone, branch, commit, tag, and raise pull requests.
  • Configure pipelines: Connect repositories to Harness CI and CD pipelines.
  • Manage access and security: Apply branch rules, CODEOWNERS, and role-based access control.

Before you begin

  • Code Repository enabled: You need a Harness account with Code Repository entitled. Go to Get started with Harness Platform to create or access an account.

    Contact Harness support:

    If Code Repository does not appear, contact your account administrator or Harness Support.

  • Repository permissions: You need Create and Edit on Repository in your Harness project. Go to the permissions reference to review the permission list, and to RBAC in Harness to configure roles.

  • Git familiarity: You should be comfortable with cloning, branching, and committing. Go to the Git SCM documentation to review the basics.


Step 1: Set up repositories

Choose how you want to bring code into Harness Code:

  • Create fresh repos: Start a new repository from scratch for new projects or microservices.
  • Import repos: Migrate existing repositories from another Git provider, such as GitHub, GitLab, or Bitbucket.
  • Mirror repos: Create mirrors of repositories from any provider so you can use Harness CI and CD while the source of truth stays where it is.

Step 2: Work in repositories

Once your repositories exist, you work with them as you would with any other Git-based SCM tool:

tip

You can perform many Git operations directly in the Harness UI without the command line, which helps team members who prefer a visual interface.


Step 3: Configure pipelines

Connect your Harness Code repositories to CI and CD pipelines to automate delivery:


Step 4: Manage access and security

Control who can reach your repositories and what they can do:

  • Configure rules and CODEOWNERS: Require reviews, status checks, or approvals before a merge, and use a CODEOWNERS file to assign reviewers based on which files changed.
  • Enable security: Turn on secret scanning, vulnerability scanning, and committer email verification.
  • Set up role-based access control: Manage broader access through Harness Platform RBAC, using the built-in Code Admin role or a custom role.

The following video walks through access control in Harness Code:


Troubleshooting

Code Repository does not appear in the Harness module list

Code Repository must be entitled on your account. Contact your account administrator or Harness Support to confirm entitlement.

Cannot create a repository in a Harness project because the option is unavailable

Creating a repository requires the Create permission on the Repository resource. Ask an administrator to assign a role that includes it.

A Harness pipeline cannot find the Harness Code repository when configuring the codebase

The pipeline and the repository must be in the same Harness project. Confirm the project scope, then reselect the repository in the codebase configuration.


Next steps

You have set up Harness Code Repository and can manage your code with the access controls and security scanning your organization requires. You can now collaborate through code reviews, automate builds and deployments, and integrate with other Harness modules.