Import repositories
Repositories are where your code is stored. When developers make changes to code in a Harness Code repository, those changes are tracked with version control. Harness Code fosters collaboration and governance with code reviews, approvals, status checks, and more.
You can create repositories directly in Harness Code or import repositories from other Git SCM providers, such as GitHub, GitLab, BitBucket, and more.
Import repositories
-
Go to the Harness project where you want to import repositories.
-
Go to the Code module, select the dropdown next to New Repository, and then select Import Repository or Import Repositories.
- Import Repository: Import a single repository.
- Import Repositories: Import all repositories in a GitHub/Gitea/Gogs organization, GitLab group, or Bitbucket project or workspace. Harness won't import repositories with conflicting names.
-
Select the Git Provider, such as GitHub or GitLab.
-
Depending on the provider, provide the administrative entity (Organization, Project, Workspace, or Group) and Host URL (if applicable) associated with your repository.
-
If you are importing a single repository, enter the name of the repository you want to import in Repository.
Harness automatically populates the Name field based on the Repository field. If you want your repository to have a different name in Harness Code, change the Name field.
-
If the repository or entity is private, select Requires Authorization and provide authorization credentials to access the repository.
Permissions required for tokens depend on the provider, for example:
- To import a Bitbucket Server repository, your BitBucket Server personal access token must have repository
Read
permissions. - To import a GitHub repository, your GitHub classic personal access token must have
repo
andread:org
permissions. - To import a GitLab repository, your GitLab personal access token must have
read_api
andread_repository
scopes.
- To import a Bitbucket Server repository, your BitBucket Server personal access token must have repository
-
Select your preference for visibility (Public or Private).
-
Select Import Repository or Import Repositories.
Work with repositories
After importing a repository, you can:
- Clone your repository.
- Create branches and tags.
- Commit changes and open pull requests.
- Configure branch rules.
- Use Harness Code repositories in your Harness pipelines.
- Set up triggers to automatically run pipelines based on activity in your Harness Code repositories.
- Configure webhooks to integrate your repositories with third-party applications.