#Gitlab Quickstart

So, you've finally decided to try this 'version control system' called git, and you want to upload some code to Gitlab... Great idea! Here is a quick and dirty guide that will get you going in no time.

Step 1: Creating an account

A) Go to gitlab.com and fill out the form (that was easy).
Note: wittelab members, talk to Nima or Clint about getting an account on our local gitlab server!

Step 2: Generating ssh keys

In order to link your computer with the gitlab account, you need to upload your public ssh key. What is this? ssh is a protocol used to securely connect to remote computer shells (think of a command line terminal window connected to a remote machine). You may be familiar with the ssh command on Unix/Linux. Do you ever get tired of typing your password? Well, ssh keys allow you to connect to remote machines without having to do so. How does it work? Imagine passing out a ton of identical opened lock boxes to everybody you know. If you wanted somebody to send you a secure item, you could ask them to put it in their lockbox, lock it, and then send to you. You could then open it with your master key. Ssh keys work kind of like that, but digitally. let's generate a master key and some lockboxes...

Skip this step you've previously generated ssh keys, that is, if you already have a file named ~/.ssh/id_rsa.
You can use [ -f ~/.ssh/id_rsa ] && echo "The file exists, skip this step" || echo "You may have to generate ssh keys" to help determine this.

A) In a terminal, type ssh-keygen. Feel free to read more about this command.
B) When it asks where you'd like to store the keys, accept the default location (press enter).
Again, only if the file doesn't already exist!
C) When it asks for a passphrase, feel free to type one in, or just press enter to continue. (repeat)

Step 3: Uploading your public ssh key to Gitlab

Now we will transfer our public ssh key (i.e. the lockbox) to Gitlab, so that the Gitlab server and your machine can talk securely.

A) Log into your Gitlab account and open the menu on the right side of the page. Click Profile Settings. Then SSH Keys.
B) In a terminal type cat ~/.ssh/id_rsa.pub and copy the output.
C) Paste that garbage into the Key box. In Title give the key a name. I usually put username@machine_name, which is the last part of the command line output.
D) Press Add key.

Step 4: Creating a repository

Now that we've authorized our Gitlab to talk to our computer, we can create a repository for our code. What's a repository? Think of it like a box that you store files in. I think these used to be called file cabinents.

A) Click on the Gitlab logo to go to the main page, and then on New Project
B) Wow, look at that! Gitlab has step-by-step instructions on how to add code!

Step 5: Basic code tracking, and beyond

A git commit is like taking a snapshot of all of your files exactly as they currently are. You are then free to modifiy them as you choose, secure in knowing that previous versions are safely stored. Even if you don't want to use the fancier features of git, it's super easy to take these snapshots!
A) Navigate to the main folder of your project.
B) Type git add . to tell git to find new changes.
C) Type git commit -m 'Some description of the new changes' to make the snapshot.
D) Type git push -u origin master to upload the code to Gitlab.

More on git later!