Categories
github tutorial

Add your code base to an existing Github repository

Github

Do you wish to add a code base folder to an existing empty repo in Github? If so, then you have come to the right place. Let us add your code base to an existing Github repository. In this small tutorial, I want to go ahead and show you how to accomplish this task in the quickest way possible.

First you will have to have an existing repository in Github, preferably an empty repository. The other thing you will need is a folder. This folder contains your code that you wish to upload to your existing repository. You will have to initialize a github repository locally by doing git init. The following action we have to do, is we have to add a remote to the newly initialize git folder. Once we have added a reference to the remote url, we can now override the old branch name with the new one adding the -M flag. The remaining item we have to do is push our committed branch and use the upstream flag.

git init
git remote add origin https://github.com/<user>/<repo>.git
git branch -M master
git push -u origin master

Awesome, we now have a working repository that you can work out of and upload your latest changes on Github.

I’ll be adding more tutorials like this one in the near future on Media Liege.