Dylan conway

Gitlab beginners guide

If you navigate to: http://gitlab.openi-ict.eu/ you will now see a login page to gitlab

I have no established our gitlab respository. Gitlab is a private install of github, so if you are familiar with using git you can ignore most of this email.

First use instructions:

  1. username is your email address in full e.g. lgriffin@tssg.org
  2. password has been emailed to you
  3. Upon successful login. mouse over the image in the top right and click my profile
  4. Go to account and change your password
  5. Optionally change your display name e.g. lgriffin was changed to Leigh for readability
  6. Click SSH Keys and click add new

Gitlab has two layers of security. Outside of the initial login to the website, to contribute to a project and add data you authenticate via SSH.

To generate your SSH key follow the instructions on:
http://gitlab.openi-ict.eu/help/ssh

It is recommended to add a password to the SSH key for a third and final security layer.

Installing git:

Download and install the latest version of git from:
http://git-scm.com/downloads

Depending on your operating system, you will now have a GUI view into git repositories but more importantly you will have access to the git environment from the command line. As a first time user of git I would strongly encourage you to learn the command line interface first. I cannot give specific help on the GUI, the documentation on the git site as well as instructional videos on youtube are excellent sources of information.

In the command line, navigate to the desired directory and run the following commands:

git config --global user.name "lgriffin"
git config --global user.email "lgriffin@tssg.org"

(replacing my username and my email address with your own)

git clone http://gitlab.openi-ict.eu/openi

You will be prompted for your username and password, which is the username and password provided above. This will initialise a git repository called openi, pulling down the latest versions of all the files and the structure associated with it.

I would recommend looking at and printing http://cheat.errtheblog.com/s/git
The main commands you will require encounter are: clone, add, rm, push, pull

Adding a file to git:

Within the openi folder, place the file you wish to add into the desired folder. If you create a new folder or subfolders and add the file there, it will automatically replicate the structure when you commit

From the command line run the following commands:

git add <filename>

Where filename is the name of the file to add or the folder to add. In the case of the folder this marks all files within the folder and subfolders for addition.

git commit -m "A meaningful commit message"

Please ensure that the commit message makes sense so we have a visible log of what each change is.

git remote add origin git@gitlab.openi-ict.eu:openi.git

This informs the git program files on your machine that you want your tagged change within your copy added to the original stored on the server. Generally this only needs to be run once.

git push -u origin master

This is the final push to the master repository. In time I might add branches off of this for milestones such as Scenario milestones but for now we will use the master. Upon initiating this, you will have to authenticate your SSH key with a password. When you established your SSH key you optionally chose a password to associate with it, that is the final security layer.

Updating a file in git:

To update a file in git simply edit the file on your machine. When you are happy to commit the changes the same process as adding a new file is followed. Mark the file for addition, commit it with a message and push your repository to the server.

git add <file>
git commit -m "My message"
git push - u origin master

If you get a message saying that your view of the repository is out of date, it means that somebody has updated the repository since you last pulled the repository down. Simply run:

git pull

Which will pull down the latest view of the repository. This will not affect the changes you are about to push, if a conflict occurs you will be informed of such and can view a diff of the files. This allows you compare changes side by side.

Additional Info:

Viewing previous versions is a matter of clicking on the commits tab. This will show you all previous commits and the associate comments. If you browse the code you will see a snapshot of the repository at that time, allowing you see previous versions. If you click on the hexidecimal code to the left of the commit, you will see details as to what files were added, modified or deleted.

Any comments or concerns please email Leigh directly.


Related

Wiki: Home