Skip to content

Forking a Git Repository and Downloading to Windows

StevenMackie edited this page Mar 15, 2013 · 2 revisions

This page looks to outline how you can get copies of a repository downloaded onto your Windows PC. This will be handy for our working group, as it means that we don't have to copy and paste code from David's Github page all the time. I used this website as a guide when I did this for the first time, so you may find this an interesting reference (although the below is not exactly the same). All of this can be done in 3 easy steps, and I use David's pyeconomics repository as an example, although this should work for any Github repository.

To Fork a Repository.

Search @Davidrpugh, then when on his Github page click on Repositories, then pyeconomics.
Click on the "Fork" button at the top right of the page and take a copy of the web link that appears toward the middle of the screen.

To Save this Repository to your Woking Directory on your PC.

Open Git Gui and click on "Clone Existing Repository". Where it asks for "Source Location" paste in the link to Pyeconomics that you copied earlier. Where it asks for "Target Directory" enter the file path to your working folder (where you want everything saved), then click "Clone". When complete, close Git Gui ##Final Steps. Open Git Bash and type the following:

  • $ cd C:/dynare/work/GIT (or whatever the file path is to your working folder)
  • $ git remote add upstream THE URL THAT YOU COPIED EARLIER
  • $ git pull upstream master

When complete, close Git Bash. If you navigate to your working folder then the contents of David's repository should be there.

Each time you wish to work on this...

... it is a good idea to enter the last command in git bash again ($git pull upstream master) as that will ensure that you are working with the latest version of David's repository. NOTE: Any changes that you make to the folders that you now have saved on your PC will not be updated to the repository on your Git Hub Page (which will have been updated automatically when you forked earlier). To update this you need to follow these simple steps:

Updating your online Github repository

I’ve not actually done this yet (!) but will update this Wiki when I do.