Git Getting started with Git Setting up the upstream remote


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 (fetch)
origin (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

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
$ git remote add dave