For this quarter, starter code for each of the programming assignments should be hosted on a git repository on UCSD’s git server: https://git.ucsd.edu. This is where each of the programming assignments will be retrieved from. In addition, you will be required to develop your assignments using git and this will also act as your turnin. When you finish your assignment, your work will be downloaded from your Gitlab repository and graded. Therefore, you should allocate some time to familiarize yourself with git and Gitlab well before the assignment due date.
The following instructions have references to "pa1" for programming assignment 1. Replace all instances of "pa1" to "pa2", "pa3" etc. based on the programming assignment you are working on.
Git is a distributed version control system that is used when developing software in industry and is a very powerful tool. If you are not familiar with git, you can check-out a quick tutorial here: https://www.atlassian.com/git/tutorial/git-basics.
This is in addition to the assigned reading for Git in class.
The following steps are intended to be performed in the labs. However, you can also do this via SSH if you are familiar with accessing the school servers via this protocol. This tutorial will not walk you through installing and using an SSH client.
For git to work correctly, a proper
.gitconfig file will need to be defined. This file stores your information such as name, email, and other git related specifics. We will be focusing on a small subset of configuration details to get you up and running quickly.
To start, you should sign into one of the lab machines running linux (NOT WINDOWS) and launch the terminal application. We will not be holding your hand on how to open the terminal emulator. You are CS majors and should be able to figure this out. :)
The file we are about to configure can be found in your home directory
~/.gitconfig after we have completed the steps below. You should make a backup of this file as it can be used on any machine where you will be using git—even for future classes. Git comes with a tool called git-config that lets you get and set configuration variables that control all aspects of how Git looks and operates. You will be using this tool to define some global configuration settings. By defining these settings globally, they will apply to all your git projects for this class as well as other classes.
At the command prompt issue the following commands:
git config --global user.name "John Doe"
git config --global user.email firstname.lastname@example.org
git config --global core.editor gvim
git config --global merge.tool gvimdiff
Yes you should replace John Doe as well as his email with your name and email -- and please don’t email John Doe.
Once you have entered the commands above, you should verify that you spelled everything correctly. Actually, you should have done this before pressing enter, but just in case, you can do this via the following command:
git config --list
If you made a mistake, simply reissue the command above that you entered incorrectly with the corrections made and it will overwrite the previous setting. Tip: To avoid being stuck at this step indefinitely, at some point, you are going to want to stop making mistakes.
In order to start your assignment, you MUST create a repository in the cse100-sp15 group. The easiest way to do so is to create your repository following the instructions below: If you are working with a partner, ONLY ONE OF YOU should perform this step.
Zackand your username is
zgrannan, then you should name the repository:
PA1-zgrannan. If you are working with a partner, and his name is
Gautamand his username is
gakiwate, you should name the repository:
PA1-zgrannan-gakiwate. You could also name the repository
https://and ends in
cse100-sp15. If the repository is not in this namespace, your code will not be accessible by the professor.
cse100-sp15, you are importing the correct repository, and that the visibility level is set to Private.
If you don't know how to create an SSH key, look here:
ssh-keygen -t rsa -C "email@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/linux/ieng6/oce/1h/your_username/.ssh/id_rsa): [Press Enter]
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
Your identification has been saved in /home/linux/ieng6/oce/1h/your_username/.ssh/id_rsa.
Your public key has been saved in /home/linux/ieng6/oce/1h/your_username/.ssh/id_rsa.pub.
The key fingerprint is:
git clone firstname.lastname@example.org:cse100-sp15/pa1-gakiwate.git
pa1-gakiwatewith YOUR repository name. Also note that this is case-sensitive, so your repository name should be in all lower-case letters.
git remote add starter email@example.com:cse100-sp15/pa1.git
git pull starter master.
git add README
git commit -m "Test Modification"
git push origin master
If you are working with a partner, go to:
https://git.ucsd.edu/cse100-sp15/[your repo name]/team and click
new project member. From there you can add your partner to the repository. Once added, they should be able to clone the repository on their own machine.
At this point, ensure that both you and your partner can access your newly created repository. Whenever you push to the repository, you should be able to view your changes online at:
https://git.ucsd.edu/cse100-sp15/[your repo name].
At any time, you can view the version of the code that the instructor will download at:
https://git.ucsd.edu/cse100-sp15/[your repo name]/repository/archive.tar.gz.
If you need to rename your repository, please follow these instructions:
https://git.ucsd.edu/cse100-sp15/[your current project name]/edit
pa1-[your ACMS username]if you are working by yourself, or
format pa1-[your ACMS username]-[your partner's ACMS username]if you are working in a pair.
pa1-zgrannanit should look like the picture below:
git remote set-url origin firstname.lastname@example.org:cse100-sp15/[your project name].git
git remote set-url origin email@example.com:cse100-sp15/pa1-zgrannan.git.
If you need to delete your repository, simply rename it as paX-delete, following the instructions in the previous section. The tutors will delete all repositories with the keyword 'delete' for you. You don't have to wait for your repository to be deleted after you have renamed it, to start working on a new one.