The outcomes of this post are:
- Differentiate Between upstream and origin on GitHub?
- How to Add “origin” on GitHub?
- How to Add “upstream” on GitHub?
Differentiate Between “upstream” and “origin” on GitHub
The “origin” and “upstream” are both used as remote URL names. Sometimes users want to keep the default remote “origin”. They can add a new remote URL to the list for cloning another GitHub repository. Then, the “upstream” can be used for this purpose.
How to Add “origin” on GitHub?
To add the “origin” remote name to the list, follow the instructions below.
Step 1: Go to Root Directory
At first, switch to the root directory by utilizing the “cd” command:
Step 2: Add Remote URL
Then, use the “git remote” command to add a new remote URL in the list for tracking the remote repository to the local repository:
Here, the “origin” is the name of our remote URL:
Step 3: Verify Remote URL
Next, to ensure that the newly added URL is placed in the remote list or not:
According to the below-given output, the previously added “origin” is added successfully:
How to Add “upstream” on GitHub?
To add another remote URL name with “upstream”, if the “origin” already exists in the list, execute the provided command:
Here, the “add” option will add the specified URL to the list:
Then, run the “git remote -v” command to verify the previously perform operation:
As you can see, the new remote URL named “upstream” is added successfully:
That’s all! We have briefly differentiated between the “upstream” and “origin” on GitHub.
When developers clone a remote repository, by default, it has a remote URL name called “origin” that points to their fork on GitHub. When developers want to keep the “origin” repository, they need to add another remote URL named “upstream”. This post differentiated between the “upstream” and “origin” on GitHub.