---
layout: default
title: Fork A Repo
description: Copy a repo to create a new, unique project from its contents.
categories: bootcamp
main_category: bootcamp
---
If you’ve found yourself on this page, we’re assuming you’re brand new to Git and GitHub. At some point you may want use another user’s project as the starting point for your own. This is known as "forking."
##First: Fork A Repo
For this tutorial, we'll be using the Fork It project.
1. Fork the “Fork It ” repo
To fork this project, click the "Fork" button.
##Next: Set Up Your Local Repo
You’ve successfully forked the Fork It repo, but so far it only exists on GitHub. To be able to work on the project, you will need to clone it to your local machine.
1. Clone the “Fork It ” project
Run the following code:
$ git clone git@github.com:octocat/Fork-it.gitClones the linked repo into the current folder
2. Configure remotes
Each repository has a default remote* called `origin`. The origin remote in your new cloned repo points to your fork on GitHub, not the original repo it was forked from. To help you keep track of the original repo, you will add another remote named `upstream`:
$ cd Fork-itChanges the active directory in the prompt to the newly cloned "Fork-it" directory $ git remote add upstream git://github.com/octocat/Fork-it.gitCreates a remote called "upstream" and assigns it the original repo URL $ git fetch upstreamPulls in any changes not present in your local repository, but doesn't modify your working files*A “remote” is a reference to the GitHub URL where your commits are stored. ##Then: More Things You Can Do Congratulations, you’ve successfully forked a repo, but get a load of these other cool things you can do: - Push commits Once you’ve made some commits to a forked repo and want to push it to your forked project, you do it the same way you would with a regular repo:
$ git push origin masterPushes commits to GitHub
- Pull in upstream changes
If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:
$ git fetch upstreamFetches any new changes from the original repo $ git merge upstream/masterMerges any changes fetched into your working files- Pull requests If you are hoping to contribute back to the original fork, you can send the original author a [pull request](/pull-requests/). ##Lastly: Celebrate You have now created forked a repo. What do you want to do next?