Before attending class, students should complete the GitHub Preview assignment.

Learning Goals

  • Create, fork, and clone repositories
  • Connect a local repository to a remote repository
  • Push and pull work between local and remote repositories
  • Navigate the key information provided about a repository on the GitHub interface


  • clone
  • fork
  • local
  • remote
  • pull
  • push

Warm Up


What does it mean to clone a repository?

How does one clone a repository?

What is the difference between HTTPS and SSH, and which should we use? Why?


In the context of GitHub, what is a fork?

Connecting a Local and Remote Repository

There are many ways to create and connect local (on your machine) and remote (in the cloud) repositories. We can’t go through every combination of ways to do that, so we will focus on one. Once you are comfortable with this, if you find another way to achieve the same outcome, you can absolutely use that.

  1. Create a local Git repository.
  2. Create a GitHub repository (do NOT check the box to create a README).
  3. Follow the directions under ...or push an existing repository from the command line, by running the following commands:
    • git remote add origin This command tells the local repository to set the remote repository to this address. We refer to it as the origin.
    • git branch -M main You do not need to do this if you have already configured Git to name the default branch main.
    • git push -u origin main This sends the current version of the project up to the remote repository, and sets the main branch as the default branch to send work up to.
  4. Refresh the browser tab GitHub is in - you should now see your repository!

What follows is a diagram that breaks down the anatomy of the git push -u origin main command: Anatomy of git push -u origin main command


Follow the four steps listed above to connect a local Git repository with a GitHub repository.

Pushing and Pulling Changes

  • Pushing work up to a repository is the act of using Git commands to send the current version of a local repository up to the remote repository.
  • Pulling work down is the act of using Git commands to retrieve the work on the remote repository so that it’s available in the local repository.

After making 1 or more commits on a local repository, we can push our work up using the following command:

git push origin main

Since we used the -u in our original push to connect the two repos, we can technically use the following command to get the exact same outcome:

git push

After running this command, Git will send the message up to GitHub (you must be connected to the internet), and you’ll get many lines of output, finally telling you the work was successfully sent up. Refresh the browser tab that GitHub is in, and the changes will be available there.

For the extent of our use of Git and GitHub workflows during Mod 0, you will primarily be pushing work up. If you ever need to pull work down, the command git pull origin main can be used.

Common Issues

Occasionally, the command to push work up will not be successful. When this happens, the user will usually see a message similar to this: Anatomy of git push -u origin main command

Almost always, the message tells the user what the problem is and exactly what to do.

Reading Error Messages

Read the error message in the screenshot above and be ready to share what you would try if you ran into this error.

Key Information on a GitHub Repository

Let’s take a tour of a GitHub repository to identify some key pieces of information.

Screen shot of Leta's GitHub repo

Navigate a GitHub Repository

Visit this repository and answer the following:

  • What is the name of this project/repository?
  • Who is the user that created and owns this repository?
  • How many commits are on this repo?
  • When was the last commit made?
  • Find 2 commit messages that do not follow conventions - write them down, and write down a better commit message to replace each.
  • How many times has this repository been forked?

Practice, Check For Understanding

Complete the following exercises to get practice and demonstrate your ability to use Git and GitHub:

Solo: Practice the Workflow

Student will work through this prompt independently, while on the call if time permits, to have the support and opportunities for feedback from each other:

  • Create a local repository.
  • Create a GitHub repository.
  • Connect the two repositories.
  • Make a few changes and commits.
  • Push up your changes.
  • View the commit history in the GitHub interface.

When this work time is over, be prepared to screenshare to show your Terminal and/or GitHub and talk through your process, challenges, and questions you have.

Class Driver/Navigator

One student will Drive while other students are randomly selected to Navigate for each bulleted task:

  • Create a local repository.
  • Create a GitHub repository.
  • Connect the two repositories.
  • Make a few changes and commits.
  • Push up your changes.
  • View the commit history in the GitHub interface.

There is no submission for the Check For Understanding for this lesson. Based on the concepts presented and practice exercises, students should self-evaluate and determine if they need more practice time and/or support.