Skip to content

Part 2: Setup your Repository

Fatema Boxwala edited this page Mar 15, 2016 · 4 revisions

Forking and Cloning a Repo

Now that you have git installed and setup on your computer, you are each going to fork a copy of this repository, and clone a local copy of it to your machine. If any of those words are confusing, try reading the Words to Know.

Make sure you are logged in to GitHub and click the Fork button in the right hand corner of this page. Once the cute little animation is done, you will own a personal copy of this repository in your GitHub account (you can see it if you go to your profile). You can do whatever you want to that repository and it will have no affect on this one. Poke around the various files you just forked for a few minutes to familiarize yourself with the GitHub GUI.

Now you'll want to clone your fork of the repository to your machine to create a local repository, so that you can work on the code.

Open a terminal (for Windows users, open git bash) and navigate to a directory where you would like to put a copy of this repository. If you have never used a terminal before, you will find this unix 101 tutorial helpful.

For example to navigate to "Documents" type:

cd Documents

Now clone your repository:

git clone http://github.com/username/git-workshop-W16.git

Where username will be replaced with your username. You can also copy this url on the top right of your repos page, next to the button that says HTTPS. Now that we've done this, git will automatically track the repository we cloned from as a remote repository. By default, it is called "origin".

Now if you run ls in your directory, you will see all the files and folders located in it, including the one you just cloned, called git-workshop-W16. cd git-workshop-W16 to change into that directory.

Now you have to tell git your name and email, so it knows who is making contributions.

git config user.name "Your name"
git config user.email "[email protected]

Finally, add this repo (and not your remote fork) as an upstream remote repository.

git remote add upstream https://github.com/wics-uw/git-workshop-W16.git

This step is necessary for making sure your repo is up to date with the shared public repository.

Once your repository is all set up, move on to Part 3: Feature Development.