Gitlab Environment
Table of Contents
What is gitlab?
Gitlab is a backend git management system, much like github, but privately hosted instead of publically available. I am hosting a gitlab instance on a server at USNA. You can reach it here:
Creating an Account
You will need to create an account on the local gitlab instance. *It is very important that your account information properly match your USNA login account*.
Pleas use the following information:
- Name: Your First Name and Last NAme
- Username: your usna network username, e.g., m179999
- Email: your usna network email, e.g., [email protected]
- Password: a good strong password, not your usna network password
Once you've created an account, the system will send you an email to complete the process.
Setting up your ssh-keys
We will exclusively use ssh as the transfer agent for git, so you must set up your ssh public key for authentication. The idea is that from a given computer where you posses the private associated with the uploaded public key, you will have access to the git repository.
To do this, log into your account on gitlab:
The first thing you'll see is a dashboard, something like this, with probably a lot less activity. And click on the profile settings option (looks like a cog) in the top right.
Then click the key symbol on the left:
Here your find your ssh-key management system. The public keys you add here will be for two purposes: (1) to access the gitlab git repositories and (2) to log on the class VM system. So let's go ahead and add a new ssh key:
Now, you will see a text box with a place to put the key:
In this box, you will paste your ssh public key.
Retrieving your ssh public key
Typically, your ssh public key is stored in the .ssh
directory
under your home folder:
aviv@mich302csd01u: ~ $ ls ~/.ssh/ authorized_keys config config~ id_rsa id_rsa.pub known_hosts known_hosts.old
There are two files, id_rsa
and id_rsa.pub
. The former is your
private key, the latter, ending in .pub
, is your public key. Go
ahead an cat
your public key to copy paste:
aviv@mich302csd01u: ~ $ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcN2gjt4kJzFOb2m/ZL75t2a2DJ5EMC0mngx5efHaQu3esGvjNLDvVOJyrMMCQ3o5ATMZD/hDulmIP3QQkKqtlfW5Hm7t2WBIF+SOIuh2VQIbtJb1aRa3+td35d7R0eRcDDEyWyDi+bkJYM/gI9ISAiwCAhDm8jNuLxQZsikGHtH51GXJr87s9WYZf49dgrQDsYKyO5l1lJppDs//DgWotjzj2Ibi7Mlah1dV+5IB3O6rVDoUTby0WJhZsn06i9rPoIDoxEcEjmbdiAt3tBjj3sHe6f3Qy0aeiwUkz7yLzWaaOyzFI1tFzjLvWl9wO0zA2bhN5N/9WSBwkcR1dFc6R aviv@mich316csd08u
That big block of text starting with ssh-rsa
through the end,
including username@host
, should be copied to gitlab.
Generating a ssh key pair
If you do not an ssh key pair, which may be the case if you just
installed a new system, then you will need to generate one using
ssh-keygen
.
Hit enter for all the default options, and when complete, retrieve
your public key in the .ssh
directory.
Testing your key pair
You should now be able to use this key pair to log into the class VM. Try the following from the account you uploaded the public key from:
ssh -p 2222 saddleback.academy.usna.edu
And you should be able to log on without having to type a password