Not logged in. Login

Working with Git and GitLab

GitLab will be used for the group work in this course. There are two pieces of technology in play here: GitLab with manages the repositories and permissions, and Git itself as a version control system.

GitLab Setup

Logging In to GitLab

Sign in to the CS GitLab server using the “SFU ID” option and your usual SFU username and password.

Set up an SSH key

You'll probably want to access the repository by SSH. If you don't already have an SSH key, you will need to generate one. This is easy on Linux (steps 1-3 there), or on a Mac. You'll have a little more work to do on Windows.

Once you have an SSH key, add the key in GitLab.

Create a Project

One group member should create a project with visibility level “Private”.

You'll only be able to search for your group members after they have logged into the system at least once. (The system doesn't have a list of SFU users, so until someone logs in, it has no idea they exist.) So each group member will at least have to visit the site and log in first.

You can then add the other members of the group to the project: in the project, select “Settings”, “Members”, and “New project member”. You can search by userid and add them with “Developer” or “Master” project access levels.

Make sure you add the instructor and TA (ggbaker, lirongl, gna17) to the project as well.

Git Setup

There are a couple of commands you need to run to tell Git who you are, before starting work. Please use your SFU email address:

git config --global user.name "**Your Name**"
git config --global user.email "**userid**@sfu.ca"

Working on the Project

On the GitLab main project page, you will find the URL where you can clone the Git repository onto your computer. The command will be something like this:

git clone git@csil-git1.cs.surrey.sfu.ca:ggbaker/your-project.git

The project page itself gives more complete instructions for the first interactions with the repository: you get a very empty repository that requires some bootstrapping.

Working with Git

A Git manual is beyond the scope of this page, but here are the bare basics:

git pull                     # get changes from your group members
text_editor some/file.txt    # do some work
git add some/file.txt        # stage those changes for commit
text_editor other/file.txt   # do some more work
git add other/file.txt       # stage more changes for commit
git commit                   # commit the changes
git push                     # push to the remote server so others can see changes

Here are some Git tutorials for more information:

See Also

Updated Mon Aug. 30 2021, 07:36 by ggbaker.