Skip to main content

GitKit (Linux Desktop Edition): Learn git and GitHub in Context

Section 4.3 Creating and Verifying the Upstream Remote

In order to pull changes from the upstream you will need to tell your local repository where the upstream is. In earlier figures, dotted orange lines were used to indicate that your local repository knew about the origin and that the origin knew about the upstream. But there was no orange dotted line from your local repository to the upstream. That is because, by default, your local repository isn’t aware of the upstream.
Like the last activity, you will be working within the KitClient for this activity.

Exercises

2.

In order to pull from the upstream you will first need to make your local repository aware of the upstream. This is done by setting a remote for it. This exercise will walk you through that process.
(a)
The git remote -v command lists the names and URLs of all of the remote repositories (or just remotes for short) that your local repo knows about. Run this command in the directory that contains your local repository.
(b)
    How is the origin remote indicated in Task 4.3.2.a represented in Figure 4.1.1?
  • It is labeled as "origin".
  • Correct! The diagram shows your origin remote on the top left side with the label "origin".
  • It is labeled as "upstream".
  • It is labeled as "local".
  • It is labeled as "feature branch".
Hint.
When you issued the git remote -v command pay attention to the name given to the fetch and pull URLs.
(c)
To create a new remote that tells your local repo about the upstream you will need the URL of the upstream repo. Use your browser to navigate to the upstream FarmData2 repo that you are using for this course and give its URL here. Hint: You can find the upstream using the link from your origin repo in GitHub. Once you find the upstream, you can get the URL by using the “Code” button in the upstream repo, it ends in .git.
(d)
The git remote command can also be used to add a new remote to your local repo. The format for this command is:
git remote add <remote repo name> <remote repo URL>
Use the above command to create a remote named upstream that points to the FarmData2 upstream repository that you are using for this exercise.
(e)
Use the git remote -v command to confirm that the new upstream remote has been added.
(f)
    The upstream remote provides your local repo with the information it needs to find the upstream repo. In git this information is represented using a URL. How is this information represented in Figure 4.1.1?
  • It is labeled as "origin".
  • It is labeled as "upstream".
  • Correct! The diagram shows your upstream remote on the top right side with the label "upstream".
  • It is labeled as "local".
  • It is labeled as "feature branch".
Hint.
When you issued the git remote -v command pay attention to the name given to second set of fetch and pull URLs.
Note that you will only need to set the upstream remote once for a repository. Once the upstream remote is set you will be able to pull from the upstream repo as often as is necessary.
You have attempted of activities on this page.