UP | HOME

Additional git documentation
COP-3223

Table of Contents

1. Muscle Memory

Once you have configured git and setup a repo, the following is the workflow for making changes to your repository and synchronizing with the remote.

emacs file.c
# edit, then exit and save (Ctrl-x Ctrl-s then Ctrl-x Ctrl-c)
git add file.c
git commit file.c
# enter a commit message, then exit and save (Ctrl-x Ctrl-s then Ctrl-x Ctrl-c)
git push
git status # to validate your work

2. Deleting a file

2.1. Stage the deletion

Use

git rm filename

to remove a file named "filename" from the repository. It will also remove it from the working directory.

You should see something like

rm 'filename'

as the output. Then follow the same directions as editing or adding a file to commit and push the file deletion. Note that the deleted file will still be recorded in the repository's log.

Validation

Part of the output should contain something like the following:

Changes to be committed:
 (use "git restore --staged <file>..." to unstage)
 deleted:    filename

There may be other information in the output, but this part shows that the file deletion is staged for commit. Once you commit the change the file will be removed from the local repo and, once pushed, from the remote repo.

Errors

If you see

fatal: pathspec 'filename' did not match any files

then the file is not part of the git repository yet and you do not need to remove it.

3. Cloning a fresh copy of your repo

3.1. Move your new local repo out of the way

mkdir -p ~/cop3223spring26/archive
mv ~/cop3223spring26/assignments ~/cop3223spring26/archive

Validation

There should be no output if this is successful.

Errors

If you see this

mv: cannot overwrite '~/cop3223spring26/archive/assignments: Directory not empty

then you have already archived a git repository. Try instead creating a unique name, e.g., by adding additional numbers or letters to the target name, such as

mv ~/cop3223spring26/assignments ~/cop3223spring26/archive/assignments2

Note that the target is now ~/cop3223spring26/archive/assignments2, with an additional assignments2 at the end, which moves and renames the ~/cop3223spring26/assignments directory.

A clever way to generate new names (that are less likely to conflict with an existing name) is to use the RANDOM environment variable, e.g.,

mv ~/cop3223spring26/assignments ~/cop3223spring26/archive/assignments.${RANDOM}

3.2. Clone your existing repo

Clone your repo:

git clone gitolite3@eustis3.eecs.ucf.edu:cop3223/$USER/assignments ~/cop3223spring26/assignments

Validation

You should see something like the following in the output:

remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

The number of objects may differ depending on your repo's contents.

Errors

  • File exists

    If you see

    fatal: destination path '~/cop3223spring26/assignments already exists and is not an empty directory.
    

    ethen you have either forgotten to move your other repo out of the way or have already cloned this repo before. You can just enter ~/cop3223spring26/assignments and pull instead, i.e.,

    cd ~/cop3223spring26/assignments
    git pull
    
  • Cloned an empty repo

    If you see something like

    Initialized empty Git repository in /home/gitolite3/repositories/cop3223/NID/assignments.git/
    warning: You appear to have cloned an empty repository.
    

    then it means you haven't yet pushed your repository yet. Go through the workflow to create your repository. If you still cannot clone it, double-check that you have typed the correct name of the repo.

  • Access denied to repo

    If you see

    FATAL: R any cop3223/ab123546/assignments ab123456 DENIED by fallthru
    (or you mis-spelled the reponame)
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    then you may have mistyped your NID. For instance, above it is ab123546, which is supposed to ab123456, i.e., the 4 and 5 are swapped.

  • Access denied to eustis3

    If you see

    Permission denied, please try again.
    

    double-check that you are on eustis.eecs.ucf.edu and not eustis3.eecs.ucf.edu. If your prompt looks like this

    NID@eustis3:~$
    

    i.e., it has eustis3 or if you type the following

    hostname
    

    and you see eustis3, then you are on the wrong server. Log out

    exit
    

    then log back into eustis (not eustis3).

3.3. Copy over any material from you old repo

For example, if you want to copy over your latest, uncommitted README.md changes from the original local repo,

cp ~/cop3223spring26/archive/assignments/README.md ~/cop3223spring26/assignments

or use ~/cop3223spring26/assignments2 or whatever name you used when moving your repo.

There should be no output.

Validation

Enter

git status

You should see (in part of your output) something like

Changes to be committed:
 (use "git rm --cached <file>..." to unstage)
 new file:   README.md

which reflects the changes to the README.md that you have copied over. If you don't see this, the the README.md either is not different from the original repo or you have not committed it yet. In the the latter case, make sure you have completely setup your repo.

Errors

If either directory does not exist, then double-check the names and that they you have followed the previous directions.

4. Uploading homework to git

4.1. Setup

On eustis, you can create, compile, and run a homework in your assignments repo:

  1. Log in to eustis

    ssh NID@eustis.eecs.ucf.edu
    
  2. Create a directory for your homework programs (if not already created):

    mkdir -p ~/cop3223spring26/assignments/hw/
    
  3. Enter the homework directory:

    cd ~/cop3223spring26/assignments/hw
    
  4. For each homework problem, use emacs to create and type out the homework problem, e.g., hw7-1.c:

    emacs hw7-1.c
    

    Be sure to use the file name provided in the homework, which corresponds to the hw number and question number.

  5. Compile and run the program to test it:

    gcc -o hw7-1 hw7-1.c
    ./hw7-1
    
  6. Repeat from step 4 as needed to get the correct program execution

4.2. Submission

Submit the homework via git using whatever file names you used for the homework programs

git add hw7-1.c
git add hw7-2.c
git commit hw7-1.c hw7-2.c
git push

4.3. Self-check

Remove the previous self-check

If you have already run the self-check, you can remove it like this

rm -rf ~/tmp/assignments_selfcheck

Double-check the path carefully to avoid deleting the wrong directory.

Make a fresh clone of your project

git clone gitolite3@eustis3.eecs.ucf.edu:cop3223/$USER/assignments ~/tmp/assignments_selfcheck

You should see something like

Cloning into '/home/net/NID/tmp/assignments_selfcheck'...

Welcome to eustis.eecs.ucf.edu.

Please use your NID and NID password to log in.

See http://t.cs.ucf.edu/help/eustis  for additional instructions.

remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 16 (delta 1), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (16/16), done.
Resolving deltas: 100% (1/1), done.

If you see

fatal: destination path '/home/net/NID/tmp/assignments_selfcheck already exists and is not an empty directory.

then remove the previous self-check.

Enter the fresh clone's hw directory

cd ~/tmp/assignments_selfcheck/hw

From here you can explore the repository to make sure that you have submitted the correct files for the given assignments. For instance, for this homework, make sure hw7-1.c and hw7-2.c are present and compile and run correctly.

Author: Paul Gazzillo

Created: 2026-07-26 Sun 20:05