Import a template from Git
This topic describes how to import various Templates from Git.
Harness enables you to add Templates to create reusable logic and Harness entities (like Steps, Stages, and Pipelines) in your Pipelines. You can link these Templates in your Pipelines or share them with your teams for improved efficiency.
Templates enhance developer productivity, reduce onboarding time, and enforce standardization across the teams that use Harness.
You can create Templates in Harness in the following ways:
Create an inline Template and save its configuration in Harness.
Create a remote Template and save its configuration in Git.
Import a Template from Git and save its configuration in Git.
This topic explains how to import a Template from your Git repo to Harness.
Before you begin
Go to Templates Overview
Permissions
To import a Template, make sure you have the Create/Edit permissions for Templates.
Import a template
You can import a Template in the Account, Org, or Project scope.
This topic explains how to import a Template in the Project scope.
You can import a Template from the CI or CD module in Harness. This topic shows you how to import a Template to the CD module.
In your Harness Account, go to your project.
In Project Settings, click Templates.
Click New Template and then click Import From Git.
The Import Template From Git settings appear.
Enter a Name for your template.
In Version Label, enter a version for the template.
If you are not using Harness Code Repository you will require a git connector. In Git Connector, select or create a Git Connector to connect to your Git repo. For steps, go to Code Repo Connectors.
In Repository, select the repository from where you want to import the template. If you don't see your repository in the list, enter its name since only a select few repositories are filled here.
In Git Branch, select the branch from where you want to import the template. If you don't see your branch in the list, enter its name since only a select few branches are filled here.
Enter the YAML Path from where you want to import the template. All your configurations are stored in Git in the Harness Folder.
Click Import.
Click on your Template to proceed. By default, Harness fetches your Template details from the default branch. If you have imported Template from some other branch, select the branch from where you imported the Template and continue.
Last updated
Was this helpful?