hamilton (hamilton.se.rit.edu) is the edit/ compile/ run environment you will use for all your work in this course
It is a Linux/ Ubuntu server that you will access via the command prompt (aka terminal)
You must have your SE account to use hamilton which is typically the same as your RIT account.
Use your RIT password
ssh hamilton.se.rit.edu
. Login to hamilton using your SE account and password. A few notes:
ssh username@hamilton.se.rit.edu
where username is your SE account name.
edit environment variables for your account
edit
C:\Windows\System32\OpenSSH
ssh-keygen -t ed25519 -C "email@example.com"
cat ~/.ssh/id_ed25519.pub
Git is a powerful source code control system that allows developers to store their source code, collaborate, and manage changes. It is a key tool in any software engineer's toolbox.
Git uses some terminology that we need to remember:
In this exercise, we will be focusing on how to use Git on the command line, including creating a repository, adding files, committing files, and pushing your changes to a remote repository.
In this course, Git is not just a tool for you to use, it's your submission system. So understanding how to use Git is critical for for this course. If you mess up your submission, you won't get credit for all your hard work.
You will be creating one personal repository for this entire course. As you work, you will be asked to make many commits at logical times. When you are ready to submit an assignment, then you will push your changes to your repository.
Let's set up our username in git. You only need to do this once for the entire semester. In your terminal (e.g., putty logged into hamilton
), use the git config command for changing user.name and user.email, like this:
$ git config --global user.name "Bojack Horseman"
$ git config --global user.email "bjh9999@rit.edu"
A neat feature in git command line is to use the coloring scheme to more easily spot the status of things:
$ git config --global color.ui true
swen-250
. Make sure the repository is private. make sure the project name is swen-250
exactly. Same spelling, same capitalization, using a dash.Reporter
permissions to your instructor and course assistant(s). You may need their usernames - be sure to ask if they have not provided it. To do this, you need to have your project page open. An easy way to make sure you have it open is to modify this link with your username: https://git.gccis.rit.edu/(YOUR_USERNAME_HERE)/swen-250. Go to Project Information -> Members on the left side of the screen at the bottom. Add ALL of your TAs and Instructor as a member with Reporter
as the type.hamilton
. To do this, go to the top rightmost of your screen.
You should see a circular symbol with a dropdown arrow next to it. Click there, go to settings
then on the left you should see ssh keys
. Click on that. You should now see two text boxes. One for your key
and one for a title
.
hamilton
. If you are logged out, log back into hamilton. Now type cat ~/.ssh/id_ed25519.pub
again and copy that ENTIRE string starting with "ssh-ed25519" and ending with your email. Paste this string into the key
textbox on the gitlab page. Enter a title
for this key-- it can be anything; make it descriptive. Something like "hamilton ssh key".clone
your new swen-250 repository onto hamilton
. Find the SSH URL for your swen-250
by clicking on Project . The SSH URL will look like git@git.gccis.rit.edu:(your_username_here)/swen-250.git
(your username will be in there)git clone
to clone the url. Make sure you clone into your home directory. Your command will look something like this: git clone git@git.gccis.rit.edu:(your_username_here)/swen-250.git
cd
name.txt
.vim name.txt
to create and edit the file
i
to start editingEsc
to stop editing and enter commands:x
to save your file and exit vimname.txt
, write your full name (so the instructor knows who you are). Save and exit the text editor.git status
. You should get output like this:
# On branch master
#
# Initial commit
#
# Untracked files:
# (use 'git add ...' to include in what will be committed)
#
# name.txt
nothing added to commit but untracked files present (use 'git add' to track)
.gitignore
create and edit the file and add the following contents. Be careful that your copy/paste does not ruin the formatting:i
before you paste (rightclick) into the file.Copy starting from line below:
# This file will prevent Git from adding files that match the following
# patterns to the repository. If you need to add a file anyway, you can use `git add -f [file]`
# Text editor swap files
*.swp
*.swo
*~
# Compiled binary files
*.o
(Copy up to line above)
Note that git will not ignore a file that was already tracked before a rule was added to this file to ignore it. In such a case the file must be un-tracked, usually with git rm --cached filename
As we expect, we've got our new file to add. Add your changes to git by typing git add .
Running git status
now gives us the following output:
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached ..." to unstage)
#
# new file: name.txt
#
git commit -m"a meaningful commit comment" .
Using the .
at the end commits all files from the current directory and below.
git commit
.
By default, git will open up the vim text editor for you to enter your commit message.
(If you would rather use nano to edit your commit messages, then run git config --global core.editor "nano").
Git commit messages have this convention:
[master (root-commit) 5d859e9] Recording my name for grading
1 file changed, 1 insertion(+)
create mode 100644 name.txt
push
. We need to push our commits to our remote repository on GitLab so the instructor can view it and grade it. Ok let's push now. The command is git push origin master
. The output looks similar (but perhaps not exactly) to this:Counting objects: 3, done.
Writing objects: 100% (3/3), 278 bytes | 278.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git.gccis.rit.edu:cdnvse/swen-250.git
3063b61..3f82b4f master -> master
You're all set up! We've synchronized our repository with our GitLab so that the instructor can see our changes. From here on, we can continue to modify, commit, and push our code right up to the deadline. Now try out the workflow below and review our tips.
Here's the typical workflow we want you to use.
add
and commit
.push
your changes.git status
.Learning this pattern of work is critical to your success as a future software engineer. Don't wait to do Git stuff until the very end of your work.
All of your assignment and projects will be in your personal repository for this course. To speed up grading, please name files and directories exactly as specified in the assignment or project description. Doing this properly is part of your grade.
To check that you have submitted, run these two commands
git status
- to make sure everything has been committed (should say "# On branch master nothing to commit (working directory clean)")git push origin master
- if it says "Everything up-to-date", you have everything pushed and submittedgit rm
or git add -A .
to record that deletion.git add . && git commit && git push origin master
Note: Git is not a misspelling of "get", it's a self-deprecating joke about Linus Torvalds
A correctly set up repository.
For this assignment, the instructor and graders will find your repository on GitLab and make sure it's set up properly.
10 points: Correctly set up repo (swen-250) with correct name.txt
and .gitignore
etc.