Create a free account. At this point in time there is no need to pay for any of GitLab's more advanced features. We can get everything done with the free tier.
Creating an Account¶
Creating an account is as simple as going to gitlab.com and registering. You do not need to provide billing information nor do you need to sign up to any free trials. Just get a free account that is using the free tier plan. That's sufficient for our needs throughout this book.
Once you have an account, login and we'll set up some groups and repositories (called "projects" in GitLab.)
For more information about how-to manage your new account, checkout this official documentation.
You're going to want to use an SSH key for cloning and pushing changes to the repositories. We discuss generating an SSH key in a future chapter, but that key is used for something different. Instead we're going to generate an SSH key for use with our GitLab account, allowing us to clone repositories and push commits back up to GitLab.
Assuming a Unix like system, we can generate an SSH key in the following manner:
You'll be prompted to provide a pass phrase. It'll look a bit like this:
1 2 3
I highly recommend you provide a pass phrase for all SSH keys, except under certain circumstances (which we'll explore later.) Enter one twice and keep it private (and stored in a password manager, ideally.)
After generating the SSH key, you'll have to add the public key part to your GitLab account so that the key is authorised to clone any repositories you create and commit changes. To do this you first need to copy the public key component of your SSH key:
And then follow these instructions over at gitlab.com:
- Login to your account if you haven't already
- Click your account icon in the top right
- In the list on the left, select
- Copy the public key you copied above into the big box under the
- Give the a
GitLab Cloning Key
- Set the key to expire after three months (optional)
I say the expiration on a key is optional, but I find it's good practice to have keys expire because it forces you to periodically review your account security settings, which can help you catch misconfiguration or even breaches that have introduced other, malicious keys
Here's what this looks like, visually:
If you get a warning saying the key already exists, then you're either using a key you've got under a different GitLab account or you've done these steps before and have forgotten.
We're going to need an access token for use with Terraform in the next section.
GitLab provides documentation that instructs you on how-to generate this token. I highly recommend you set the token to expire after 24 hours, or at the most, a few days. This is because you'll likely move on and forget about it. You don't want a token hanging around with indefinite access to your GitLab account.
Create a token with only
Here's a visual reference for creating an access token: