I've created a private project in Gitlab and I'm trying to write down a simple deployment script to start the project after downloading it from the repository, and I'm using Ubuntu's bash environment to execute the script.
I've done the same with a public project using a simple curl command:
curl -fSL "https://gitlab.com/MyUsername/MyProject/repository/archive.zip?ref=master" -o project.zip
There are answers out there showing how to do the same for a private project using Gitlab's username+password or private_token
and the curl command. But I prefer to use the "deploy keys" features provided with Gitlab. So far I've done as it is instructed by Gitlab's documentation:
ssh-keygen -t rsa -C "$your_email"
And then uploading the public key file to deploy keys of my project in Gitlab. My question is: how can I use the private key that I have to download the latest revision of my project? Should I use curl
or scp
or anything else? Please also include examples for when the project belongs to a group.