Problem Statement:
Harness user experiencing Error while setting up Git connector using SSH Credentials
If a git connector is improperly set up, often a not authorized message will appear as well as the Connection test fill fail. The issue is very likely caused by the SSH key that is being used for the connector.
Scenario:
While setting up a git or Github connector in Harness NextGen UI
Solution:
Solution Summary:
This issue is often caused by the username of the SSH key object is not of a value needed in order to access the specified resource. In this case git.
Here are steps that can be followed to resolve this issue.
- Go to the problematic Connector. In my example, this is a git connector, and select Edit Details.
-
Overview Page: Set Name, Description, and Tag(s)
-
Details Page:
-
URL Type β Select either Account or Repository
-
Connection Type β Select SSH
-
Github Account URL β example: git@github.com:accountname
-
Test Repository β enter in the repo name that is used to test the credentials
-
Credentials Page:
-
Select Create or Select a Secret inside the SSH Key field
-
This will create a dialog box where you can either select new SSH Credentials or use existing Credentials. For this scenario, we believe that the SSH credentials that might have been used initially were set up incorrectly.
Steps to correct the SSH Credentials
-
Either by following the previous steps or by going to the Secrets module of either the
-
Account: Account Settings β Account Resources β Secrets
-
Organization: Organization Resources β Secrets
-
Project: Project Setup Drop Down menu β Secrets
-
In the New Secret Drop Down, select SSH Credentials
-
SSH Details Page
-
Select Name as well as optionally the Description and Tags
-
Configuration and Authentication
-
Select an Auth Scheme β Select SSH Key
-
Select Username/ SSH Key
-
Username: This is where you want to select the user name that Harness will use with the SSH command to access the external resource. In this case it will be βgitβ
-
Select or create an SSH key File. The key file will have your secret key that Harness will use for authentication
-
Select Passphrase that will be used with the key file
-
Select SSH Port number
-
Verify Connection
-
Add a Host Name to start verification. Example: github.com
Finishing the Github connector setup
- Connect to Provider either via Harness Platform or from a Harness Delegate
- Finish the process to test the connection