Week 5 Exercises: Git and GitHub

Author
Affiliation

Jelmer Poelstra

Published

September 20, 2025



Introduction

In this exercise, you’ll practice with creating and pushing to GitHub repositories.

Setting up

  • Start a VS Code session through OSC OnDemand in the folder /fs/ess/PAS2880/$USER.

Exercise 1: GitHub

  1. Go to the GitHub website, log in, and create a new GitHub repository. This will be the remote counterpart of the Git repo you made as part of last week’s assignment. You can give the GitHub repo any name you want.

  2. In the terminal in VS Code, navigate to your dir for last week’s assigmment. Then, use Git commands to set up a connection between the Git repo and the GitHub counterpart.

  3. Push your local repo to the online counterpart.

  4. Explore your repo on GitHub. Does your README.md render well? Can you see all your commits?

  5. Open a GitHub Issue for your repo: on the GitHub page for your repo, in the Issues tab, click “New Issue”, and in the box where you can type your issue, tag the instructor. For example:

    Hey @jelmerp, can you please take a look at my repo?

    (You will use this approach to “hand in” the remaining assignments for this course.)

  6. Back in VS Code, add a line to your README.md that mentions you created a Github repo on today’s date, adding the repo’s URL.

  7. Commit the change to README.md to your Git repo.

  8. Push to the remote and check that the changes were applied in the online repo.

Solutions

Exercise 1

2. Navigate, then set up a connection to the online repo
cd GA2

# (replace <SSH-URL-to-repo> with your actual SSH (not HTTPS!) URL)
git remote add origin <SSH-URL-to-repo>
3. Push your local repo to the online one you just created

When you push to a remote repo for the first time, you need to add the -u origin main part:

git push -u origin main
7. Commit the change you made to README.md
git add README.md
git commit -m "Update README with GitHub repo information"
8. Push to the remote

Since you’ve pushed to this remote before, a simple git push works:

git push
Back to top