Xiannong Meng
Last revised September 6th, 2013
Based on work by others, in particular Brian King, Felipe Perrone and colleagues from ECST.
This is a brief introduction to the use of Gitlab, a front-end (web user interface) to Git. For general introduction to Git itself please use other resources. In this description, I used my user name xmeng and project name csci479-f13 as an example, readers need to replace them with proper names.
Gitlab is a distributed version control system. Gitlab provides a web user interface to using the core Git software. A user can share his/her software repository created and maintained by Git through Gitlab.
A general workflow for a user to use Bucknell's Gitlab is as follows. The detailed steps are in the section following this one.
In a typical course context, a student would have to do the following steps to share her Git repository with the instructor and her teammates. The instructor can collect and grade student work then send back the comments to students through Git. The teammates would have access to a common code base.
Create an ssh (secured shell) key on your Linux system, if you haven't done so. Run the following command at your Linux prompt.
ssh-keygenTake the default parameters as prompted by the command. When finished, you will see a file named id_rsa.pub in a directory called .ssh in your home directory. You will need to use this key (a text file) when creating the Gitlab account.
Click the "+" sign (the title "New Project" appears next to the plus sign) to create a project. Call the new project "csci479-f13" (or other name when in different semester and different courses)
Once created, you will see the project is assigned an URL similar to the following
git@gitlab.bucknell.edu:xmeng/csci479-f13.git
within Gitlab.
where my user name "xmeng" and the course number "csci479" are used in the example. You should see your user name and your course number instead.
An email will be sent to you from Gitlab to confirm that you have created a Gitlab project. You can ignore this email.
Note that in the example commands below, I used my information for user name and email. You need to replace them with yours. The bold-face words mean the actual command you should type. The text followed by the colon, including the colon, if any, explains what the command means.
Note that this permission has nothing to do with the file permissions on your local Linux (or Windows) file systems. The permissions on the Gitlab website are used only within the Gitlab context, not even your local Git copy.
Now that you haven owned a Git project both on the Gitlab server and on your local Linux account, you can create more directories and files under the Git structure and share them with your teammates or your instructor.
The basic idea is that you can create, revise, or remove any files under the current local Git tree, e.g., under your csci479-f13 directory. When you revise any existing files or create any new files, you should manually add the them to the local copy of Git by using the command git add and commit to the local Git copy by using the command git commit. You can synchronize the repository with remote (web) Git server by using the pull (from the Git server) and push (to the Git server) commands.
Here are a few commonly used commands to manage your Git repository.
Note that in order to push (or pull) a project, you must have either created the project (e.g., using the git init command), or cloned the project (e.g., using the git clone command, see below).
Doing so creates a copy of csci479-f13 project on your local file system in a directory other than your original directory. You can use this command to "import" a project from Gitlab that was not originally created by you (e.g., by your teammates.)