1 First steps
Go to https://webis16.medien.uni-weimar.de/gitlab and log in with your university account if you haven't done so already. This is the same username and password that you have been using for our CVS. On your first login, your gitlab account will be created automatically.
You may not be able to see any projects yet, because you need to be granted access by one of our staff; if you have registered your account some time ago and still can't access any projects, please notify the
webisstud mailing list.
2 Exploring GitLab
Once you have access, you will see our projects at https://webis16.medien.uni-weimar.de/gitlab/explore/projects/
The projects are organized in mostly the same way that they were in CVS. Top-level folders under
code-in-progress are now called groups in GitLab. For instance
webisstud is now a group with the URL https://webis16.medien.uni-weimar.de/gitlab/webisstud.
You can see a list of all groups here https://webis16.medien.uni-weimar.de/gitlab/explore/groups
Each former CVS module on the second level of the hierarchy is now a project in GitLab, and has its own Git repository. For example, the project
code-in-progress/webisstud/wstud-clickbait-ws16 is now project
wstud-clickbait-ws16 in group
webisstud with the URL https://webis16.medien.uni-weimar.de/gitlab/webisstud/wstud-clickbait-ws16
3 Authentication, Cloning and Updating Projects
Each project page displays a clone URL under the project name. Two methods are supported: SSH and HTTPS, which have different clone URLs. The HTTPS method only uses your username and password. The SSH method is more convenient, but requires some up-front setup. You need to generate an SSH key pair, and make the public key known to GitLab. If you don't have an SSH-key pair, you can generate one by running
ssh-keygen -t rsa -b 4096
and following the instructions. Although not required, it is recommended to set a password for encrypting your private key.
Once your SSH key has been generated, copy the contents of
~/.ssh/id_rsa.pub (or whatever file you chose to store your public key in) into the Key field at https://webis16.medien.uni-weimar.de/gitlab/profile/keys and click Add Key. This will add the public key to your GitLab account, so you can use you the corresponding private key to pull from and push to GitLab via SSH. Make sure to keep the private key part in
~/.ssh/id_rsa secret at all times! If your private key gets compromised, delete the public key from GItLab and create a new key pair to prevent others from gaining unauthorized access to our Git repositories.
If you are using the
webis command (see next section), then
webis git init will automatically create an SSH key pair for you if you don't have one.
Once you have an authentication method set up, you can paste the clone URL behind
git clone in your terminal. For example, to clone the clickbait project using the HTTPS method, you would use:
git clone https://webis16.medien.uni-weimar.de/gitlab/webisstud/wstud-clickbait-ws16.git
With SSH this would be: (note the different domain name)
git clone firstname.lastname@example.org:webisstud/wstud-clickbait-ws16.git
Both URLs can be looked up and copied from the project page in GitLab.
3.1 Updating Your Working Copy
To update an already cloned working copy with the latest changes from GitLab, use
git pull to pull in the latest remote revision.
git pull is a shortcut for
git fetch, which retrieves the changes from the server, and
git merge, which merges the fetched changes into your local working copy.
3.2 Pushing Changes, Note to CVS Users
Please be aware that, unlike CVS or SVN, Git is a distributed version control system. That means that a
git commit only commits into your local working copy. To push the changes back to our central GitLab instance, you have to use
git push after committing your changes. It is strongly recommended to commit often and in small atomic units with meaningful commit messages. That way you document your work progress and create a comprehensible history. Once your work is finished or at the end of a work day, you can bulk-push all your commits back to the server with a single
git push (of course you can push more often if you like).
Other than CVS, Git makes branching easy and cheap. It is therefore quite convenient to work with different branches once you have made yourself familiar with Git. Therefore, if you are feeling comfortable enough with Git already and are working on a larger new feature, you can create and switch to a new branch with
git checkout -b branchname. When your work is finished, you can merge the changes back into the main branch with
git merge. If the main branch has diverged in the meantime, you can incorporate the changes using
git rebase before merging your feature branch back in. More information about branching and merging and rebasing can be found in the free online Git book.
3.4 Further Resources
If you need further instructions on working with Git from the command line, you can find many good tutorials online, such as the following:
4 Working with the
webis Command Line Tool
We provide a convenience command line tool called
webis to help you work with Gitlab. This will be installed on all of our lab machines; instructions for installation on your own machine will follow.
If this tool is already installed on your lab machine, run
webis git init and follow the instructions to configure it. Following that, there are several ways to clone multiple projects from GitLab:
- clone all projects that you have currently checked out from CVS:
- go (
code-in-progressin your CVS workspace directory
webis git cvstree2git
- go (
- clone all projects from one or more GitLab groups:
- create a directory for your git workspace and switch to it
webis git clone-groupsand select the project group(s) you want
- after pressing return, all selected project groups will be cloned
You can then import all of the cloned projects into your IDE at once.
webis git clone-groups can also be used for keeping your cloned working copies up to date.
5 Working with Eclipse
To avoid confusion with existing CVS projects, start with a new Eclipse workspace, or remove existing
code-in-progress projects before you begin.
5.1 Cloning Projects
You can clone individual projects directly from Eclipse using the following method:
- from any GitLab project page, copy the clone URL under the project name (next to 'SSH' or 'HTTPS')
- In Eclipse, go to the Git Repositories view (Window -> Show View)
- right click the Git Repositories view, and select paste repository path or URI
- in the following dialog, select the appropriate protocol and click Next
- select the
masterbranch, then Next, then the destination directory on your local machine, and click Finish
5.2 Interacting with Git from Eclipse
Right click on any project in your workspace, select Team, and then Pull to download updates from GitLab into your local repository. The Team menu also provides options for committing your changes to your local repository and pushing your commits to GitLab.
The Git Repositories view allows you to update all of your local repositories at once: click the view area, press
Ctrl-A, then right-click and select Pull.
6 Working with IntelliJ IDEA
If you use IntelliJ IDEA, there is a slightly more convenient process with the Gitlab Projects plugin. Go to Configure -> Plugins -> Browse Repositories and install the plugin. Afterwards, there is a new option GitLab under Check out from Version Control.
From there, go to Settings to configure the plugin, enter https://webis16.medien.uni-weimar.de/gitlab as URL.
The Access Token must be generated from your GitLab profile page at https://webis16.medien.uni-weimar.de/gitlab/profile/personal_access_tokens.
After you click Refresh, you will see our project groups, which you can expand to find and clone individual projects.