Use SSH keys to clone git repositories
This topic explains how to create an SSH key for your Git repository, store that secret in IAG’s secret store, and associate the SSH key with an IAG repository. You can then use the key during service execution when a repository is cloned.
This process is necessary if your repository uses SSH-based authentication to perform a Git clone. IAG supports SSH authentication but doesn’t support HTTP authentication for Git clones performed during service execution.
Prerequisites
You must have an IAG secret store configured with an encryption key. If you haven’t created your secret store yet, see Configure IAG secret store.
Use SSH key to access git repositories
Generate Git SSH key
Use SSH keygen to generate a key specifically for use with IAG:
The output shows that the system generated the private and public SSH key in your current directory:
You need to place the file content from gateway-git-key.pub in your preferred Git service as a new authentication key.
For this demonstration, we use GitLab. Navigate to the GitLab SSH Settings to see all your keys listed. Click Add new key and paste in the contents of your SSH public key.
Add private key to IAG secret store
After your public key is in GitLab, add your private key to IAG’s secret store. Run the following command where the private key is located:
The command uses the ”@” symbol to indicate that this is a file with the full path to the private key. In this case, the private key is the gateway-git-key file created by your SSH keygen command.
You can view the contents of the SSH key in IAG’s secret store:
To securely output the decrypted data, the system saves the secret in a temporary location and displays it in your default editor. If you don’t set an editor, IAG defaults to vim. The editor is determined by your $EDITOR environment variable. To set a different $EDITOR:
When you close your editor, the system deletes the file that displayed your secret’s contents.