Skip to main content

GitKit (VSCode Edition): Learn git and GitHub in Context

Section 2.8 Cloning Your Origin

The next step in the basic FOSS workflow is to ensure that you have a clone your origin repository in your development environment as shown in Figure 2.8.1. Having a clone of your origin in your development environment will allow you to edit the files to fix the issue that you have been assigned and add those changes to the repository.
Creating a clone of your origin repository creates a copy of it in your development environment. This copy is your local copy.
Figure 2.8.1. Cloning your origin repository from your GitHub space to your development environment.
In some development environments cloning the origin requires that you use a command like git clone <originURL>.git to create the clone.
However, the development environment you have opened in GitPod simplifies this process for you. Recall, that you provided the URL of your origin repository when opening the development environment in Task 2.7.1.2.b. When you did that, a clone of your origin was automatically created for you in your development environment.

Exercises

1.

The development environment displays the files and directories contained in your clone in the "Explorer" panel at the left of the window. You can also see a list of these files and directories by using the ls -a command in the Terminal.
Compare these files and directories to those in your origin repository on GitHub. Are there any differences? If so describe them here.

2.

In this exercise you will see that your clone keeps track of the location of your origin repository. It does this using a piece of information called a remote, which Git uses to store the URLs of remote repositories in the cloud (e.g. on GitHub).
(a)
Use the following command to ask Git to display a list of the remote repositories (i.e. those on GitHub) that it knows about:
git remote -v
Copy and paste the output of the git remote -v command here.
(b)
    Examine the output in Task 2.8.2.a. How can you tell from that output that your clone knows about your origin?
  • The "origin" lines have a URL with your GitHub username in them.
  • There are lines that say "origin".
  • The "origin" lines have a URL that points to GitHub.
  • It is not possible to tell from the output.
Hint.
Look closely at the "origin" URLs.
(c)
    How is the origin remote that you see in the output of the Task 2.8.2.a command represented in Figure 2.8.1?
  • The orange dotted arrow from the clone to the origin repository.
  • The orange dotted arrow from the origin to the upstream repository.
  • The orange dotted arrow from the clone to the upstream repository.
  • The blue "Clone" arrow from the origin to the cloned repository.
  • The origin remote is not represented in the figure.
Hint.
Which arrow would represent the clone knowing the location of the origin?
(d)
    Which step of the basic FOSS workflow requires that your clone know the location of your origin repository?
  • Pull request
  • Fork
  • Clone
  • Edit
  • Push
Hint.
Think about which step of the basic FOSS workflow will need to send information from the clone back to the origin.
You have attempted of activities on this page.