Generate a key that you can use when adding a Git repository that requires authentication.

This approach requires that you generate an SSH key for Git access, and then use that key when you create a repository credential. You also need to identify your repository using the SSH URL when adding it to your cluster.

Prerequisites

Make sure that you have access to your Git repository.

Procedure

  1. Generate an SSH key pair using ssh-keygen.
    ssh-keygen -t key-type
    For example:
    ssh-keygen -t ecdsa-sha2-nistp256
  2. Keep the private key, you'll use it when creating a repository credential .
  3. Copy the public key to your Git repository server.
  4. Retrieve the host key from Git using ssh-keyscan.
    ssh-keyscan -t type hostname
    For example:
    ssh-keyscan -t ecdsa-sha2-nistp256 github.com
  5. Copy the host key from this output, you'll use it when creating a repository credential.

Results

You now have the following keys that you can use when creating a repository credential to authenticate your cluster for continuous delivery from a Git repository.
  • a private SSH key
  • a host key

What to do next

Use your new SSH key when you create the repository credential, as described in Create a Repository Credential for a Cluster or Cluster Group.

When you add the repository to your cluster, as described in Add a Git Repository to a Cluster or Cluster Group, use the SSH URL.