This tutorial will walk you through adding an SSH Key to your GitLab account and cloning a GitLab private repository in a Refactr pipeline.
This tutorial assumes you already have:
Generate a suitable SSH key pair.
The best method for generating a key pair will vary depending on your operating system. See the following articles for more information:
Log in to GitLab, click on the “Account Menu” at the top right and select “Settings”.
Copy and paste the public key generated previously into GitLab:
In your Refactr project, click on the “Credentials” on left navigation. Click “New Credential”, and proceed to create a new credential of the type “Built-in: SSH Private Key”.
Copy and paste the private key generated previously into the SSH Private Key field.
Optionally, you can select the new credential you created in the previous step as the value for this variable.
In GitLab, navigate to the repository you wish to clone, and copy the SSH URL.
Switch back the the “Variables” tab in your Refactr Pipeline and add the additional variables as shown in the image below. Paste the SSH URL from GitLab into the value for the Repository URL. Make sure to save when you are done!
To add a Git Step Module into your pipeline:
Click “Save” at the top left of the builder and a “Save Pipeline” dialog box will appear. Enter revision notes, and then click “Save and Exit”.
Click “Run” at the top left of the pipeline and the “Run” dialog will appear. Update any variable values as needed, and then click the button “Run” again at the bottom.
After clicking Run, you should see the current run in progress. You can see the console output of the selected run. If the run was successful, you should see a green check mark on the Git step to the left and some positive console output (as seen below).