Sitemap
rouzbeh

rouzbeh

hello world.

GitHub & Pair Programming

2 min readJul 20, 2015

I have recently been attending a development boot camp to become a full-stack JavaScript Engineer and have run into major problems when trying to work on the same project with my paired partner. The partners change on a daily basis and they both usually have to start by forking a repository from GitHub. Unfortunately, a forked repository from a private repository does not allow collaborators so we have some steps to take to prepare a new repository we can both contribute to since pair programming only involves one computer to be used.

The first step is to fork the main repository to your own account. After forking this repository, you then clone it on your local machine.

git clone /url of forked branch/

Once you have a local copy you go back into your online account and create a fresh repository on it and add your paired partner as a collaborator under the settings of the new repository.

Get rouzbeh’s stories in your inbox

Join Medium for free to get updates from this writer.

So now you have the forked repo, the fresh new repo with your partner as a collaborator and the original repo you forked from. Once this is done you have to set a couple of remotes to link them all together. First, by default, you will have a link to the forked repo as origin so now you have to add a remote to your new repo you want to collaborate on with the following command:

git remote add <any name you call it> /url off freshly made repository/

Now you have to link back to the original repo you forked from with the same method:

git remote add <upstream> /original repo url/

I called it upstream as this is the convential name for it and makes sense as it is a stream up to the original code base.

So now you have a link to the original repository, your forked repository (by default) and your new collaborative repository. Once all this is done you can now git push to your collaborative repository so your pair programming partner can clone it to their desktop.

git push origin /collaborative repo link name/

Origin is your default name for your forked repo that we cloned to our local machine as described earlier and you want it to be the exact same as the collaborative one at the beginning. Once your all set with all repos at the same point you can now have your partner add the same remote links to your forked repo and the original repo that started this all.

Now you should be good to go to be able to collaborate on the same repository and once finished pushing back to the forked and original repo!

Good luck!

--

--