Skip to main content
Contents
Dark Mode Prev Up Next Profile
\(\newcommand{\N}{\mathbb N} \newcommand{\Z}{\mathbb Z} \newcommand{\Q}{\mathbb Q} \newcommand{\R}{\mathbb R}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 2.9 Cloning Your Origin
The next step in the basic FOSS workflow is to ensure that you have a
clone of your
origin repository in your development environment as shown in
FigureΒ 2.9.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.
Figure 2.9.1. Cloning your origin repository from your GitHub space to your development environment.
Subsection 2.9.1 Clone URL
In order to clone a repository into your development environment you will need the
clone URL for that repository. The steps in this section will help you find the clone URL for your origin repository.
Exercises
1.
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.7.3 .
2.
Find and click the green "Code" button.
3.
Open the "Local" and "HTTPS" tabs as shown here:
The URL in the "Clone using the web URL" box is the clone URL that you will need to clone your origin repository.
4.
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.7.3 ). This clone URL should contain your GitHub username and end in
.git
.
Subsection 2.9.2 git clone
The
git clone
command will make a copy of your fork on GitHub and make the Local Copy on your computer (in your development environment). Refer to
FigureΒ 2.9.1 .
Now that you have the clone URL for your origin repository, use the steps in this section to clone your origin into your development environment.
Exercises
1.
The
git clone <URL>
command is used to clone your origin repository into your development environment. For example, if your clone URL is https://github.com/janed/test.git the command would be
git clone https://github.com/janed/test.git
Give a command that will clone your origin into your development environment.
2.
3.
Which of the following appear in the output from entering the command from
ExerciseΒ 2.9.2.2 ?
Cloning into
Sending objects
Deleting objects
Resolving deltas
Counting objects
local:
Hint .
Look at the output in your terminal.
4.
Which line of output from entering the command from
ExerciseΒ 2.9.2.2 indicates the directory into which the repository was cloned?
Cloning into
Correct!
remote: Counting objects
This line of output does not contain a directory name.
Receiving objects
This line of output does not contain a directory name.
Resolving deltas
This line of output does not contain a directory name.
Hint .
Look for a line in the output that indicates a directory name.
5.
Use the
ls
command to confirm that the directory you identified in
ExerciseΒ 2.9.2.4 now exists.
Subsection 2.9.3 Exploring Your Cloned Repository In Your Development Environment
In this section you will briefly explore the GitKit FarmData2 repository that you have cloned into your development environment.
Exercises
1.
Use the
cd
command in the Terminal to change into the directory containing your clone of the GitKit FarmData2 repository.
2.
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.
Check all files and directories that do not appear both locally and on GitHub.
Subsection 2.9.4 git remote
In this section 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).
The command
git remote
on its own will show you the
names of the remotes that git knows about, but not their URLS.
If you want to have git display the URLs of the remotes as well, you will need to add the
-v
or
--verbose
flag:
git remote -v
Exercises
1.
Which command will show you the URL(s) of the remote(s) that git knows about?
Correct!
git remote
does not show the URL(s) of the remotes.
-url
is an unknown option.
git url
is not a git command.
Hint .
You are asking
git remote
to give you more information.
2.
Execute the command
git remote -v
in your terminal. 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.
Correct!
There are lines that say "origin".
Look more carefully at what follows the word "origin".
The "origin" lines have a URL that points to GitHub.
The URL should point to a repository in your GitHub account.
It is not possible to tell from the output.
Review the output more carefully.
Hint .
Look closely at the lines that begin with "origin". Do the URLs point to a repository in your GitHub account?
3.
The orange dotted arrow from the clone to the origin repository.
Correct!
The orange dotted arrow from the origin to the upstream repository.
Neither the origin or the upstream repository are the clone.
The orange dotted arrow from the clone to the upstream repository.
The upstream repository is different from the origin.
The blue "Clone" arrow from the origin to the cloned repository.
The blue "Clone" arrow indicates where you cloned from.
The origin remote is not represented in the figure.
Look more carefully at the figure.
Hint .
Which arrow would represent the clone knowing the location of the origin?
4.
Which step of the basic FOSS workflow requires that your clone know the location of your origin repository?
A pull request facilitates communication between the origin and upstream repositories.
Forking is used to create the origin repository.
This is used to create the clone.
Editing affects only local files.
Correct!
Hint .
Think about which step of the basic FOSS workflow will need to send information from the clone back to the origin.
Subsection 2.9.5 Opening the GitKit FarmData2 Repository Folder
You cloned your fork of the GitKit FarmData2 upstream repository into a folder in your development environment with the command in
ExerciseΒ 2.9.2.2 .
But, you need to reopen your development environment in that folder to take advantage of all of the features that the KitClient provides for you.
Exercises
1.
Open your clone of the GitKit FarmData2 repository.
You can do this by going to the "hamburger" (β‘) menu in the upper left of your development environment window.
Choose
File > Open Folder...
Select the folder containing your clone of the
GitKit FarmData2
repository and click
OK
.
You will see
Setting up your Codespace
, and then your terminal will show a message from the
Kit-tty .
2.
The output in
ExerciseΒ 2.9.5.1 should contain a message from the
Kit-tty . What is the
Kit-tty ?
Your personal virtual assistant.
Correct!
Kit-tty is not a physical device.
Commmunicaiton is not occurring across a phone line.
Meow! A pet kitten would be nice, but no...
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.
You have attempted
of
activities on this page.