# Configuring an Upstream Remote

This is something I often do but rarely remember the steps for. This post is intended to serve as a reminder for me and anyone else having the same question: how to add an upstream remote git repository.

Start by forking the repository you are contributing to and cloning that repository to your local file system. In this example, we will use the Elasticsearch repository and assume you have cloned it locally.

 1  git clone https://github.com/soofaloofa/elasticsearch.git 

Now, we can add the upstream remote using the following command.

 1  git remote add upstream https://github.com/elastic/elasticsearch.git 

Now that you have a remote repository configured, you can fetch all branches:

 1  git fetch upstream 

From here, you can checkout a branch to base your work off of. In many cases, this means rebasing your changes onto the upstream branch:

 1  git rebase upstream/master 

This is basic git stuff, but since I always end up searching for it, I thought it would be useful to write it down for future reference. So, here it is!