Skip to main content

GitKit (Linux Desktop 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.

Exercises

1.

In order to clone a repository into your development environment you will need the clone URL for that repository. The steps in this exercise will help you find the clone URL for your origin repository.
(a)
Visit the GitHub page for your origin repository.
Hint.
You can find the URl of your origin (i.e. your fork of the GitKit FarmData2 upstream) in your answer to Exercise 2.6.3.
(b)
Find and click the green "Code" button.
The green "Code" button in GitHub.
(c)
Open the "Local" and "HTTPS" tabs as shown here:
The GitHub dialog showing the clone URL.
The URL in the "Clone using the web URL" box is the clone URL that you will need to clone your origin repository.

2.

Copy and paste the clone URL that you will use to clone your origin as your answer to this exercise.
Hint.
Be sure you are using your GitHub origin repository (see Exercise 2.6.3). This clone URL should contain your GitHub username and end in .git.

3.

Now that you have the clone URL for your origin repository, use the tasks in this exercise to clone your origin into your development environment.
(a)
Use the following command in the Terminal to clone your origin repository into your development environment:
git clone <clone URL>
Be sure to replace <clone URL> with the clone URL you found in Exercise 2.8.2.
(b)
Copy and paste the output from your command in Task 2.8.3.a as your answer here.
(c)
Examine the output in Task 2.8.3.b. Into which directory in your development environment was your GitKit FarmData2 origin cloned?
Hint.
Look for a line in the output that begins with "Cloning into".
(d)
Use the ls command to confirm that the directory you identified in Task 2.8.3.c now exists.
If it it does not, check the output in Task 2.8.3.b for error messages and try Task 2.8.3.a again.

4.

The the output in Task 2.8.3.b should contain a message from the Kit-tty. What is the Kit-tty?
Hint.
The "Kit-tty" introduces itself using the line "😺💻 Meow, Kit-tty here!" Read the description of the "Kit-tty" that follows this line.
Be sure to keep your eyes open for messages from the Kit-tty as you work on the GitKit exercises. The Kit-tty will help you to stay on track and may save you a lot of time by preventing you from going down an incorrect path.

5.

Use the final line of output in Task 2.8.3.b that begins with "IMPORTANT" to complete this exercise.
(a)
    What does the "IMPORTANT" line ask you to do?
  • Close the terminal and open a new one.
  • Take the Kit-tty for a walk.
  • I’m sure the Kit-tty would like that, but its not the correct answer.
  • Use the git clone command.
  • Delete some unnecessary files.
(b)
If you haven’t already, close the Terminal you are currently using and open a new one.
There is a technical reason for having to close your current Terminal and open a new. But the details for why this is necessary are unimportant.

6.

In this exercise you will briefly explore the GitKit FarmData2 repository that you have cloned into your development environment.
(a)
Use the cd command in the Terminal to change into the directory containing your clone of the GitKit FarmData2 repository.
Hint.
See Task 2.8.3.c for the name of the directory.
(b)
Use the ls -a command to display the names of all of the files and directories in your clone of the GitKit FarmData2 repository.
Compare these files and directories to those in your origin repository on GitHub. Are there any differences? If so describe them here.

7.

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.7.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.7.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.