How to Setting up the upstream remote in git.

How to Setting up the upstream remote in git.


If you have cloned a fork (e.g. an open source project on Github) you may not have push access to the upstream repository, so you need both your fork but be able to fetch the upstream repository.


First check the remote names:

$ git remote -v

origin https://github.com/myusername/repo.git (fetch)

origin https://github.com/myusername/repo.git (push)

upstream # this line may or may not be here


If upstream is there already (it is on some Git versions) you need to set the URL (currently it's empty):


$ git remote set-url upstream https://github.com/projectusername/repo.git


If the upstream is not there, or if you also want to add a friend/colleague's fork (currently they do not exist):


$ git remote add upstream https://github.com/projectusername/repo.git

$ git remote add dave https://github.com/dave/repo.git



1. How to install git in your PC. Git Installation step by step easy explation.

2. How to create your first repository, then add and commit files in git step by step.  

3. How to Clone a repository in git. 

4. How to Share a code trough git. 

5. How to Setting your user name and email in git.

6. How to Setting up the upstream remote in git.

7. How to Learn about a command in git.

8. How to Set up SSH for Git. 

Post a Comment

0 Comments