Go to github and select “New Repository”
Enter the name of your repository (this needs to be unique to your github profile)
Click “Create Repository”
TIP: When you create a repo in Github, they basically give you the step by step instructions required at the local command line to initiate a new local repo and push it up to github:
Go to your PC/Mac and fire up a command line…
Navigate into the directory of your software project:
Initialise you local git repo (if there isn’t one).
This command initiates a new local git db that is used for managing your source code, you should see a successful initiation message as detailed below:
If you type the following, you'll see the current status of your local git repository:
This shows us that while the repository has been initiated, none of the files (and directories), are being "tracked". This means they are not under git version control. To rectify this, issue the following command to add all files (and directories), for git tracking:
git add .
Get the status of your repository now and you will see that all files are being tracked:
We now need to "commit" the changes we've made, (in this instance it's just adding all files to git version control), by issuing the following command, (the -m is message flag that allows us to add comments for this commit, this helps us track which files have been affected by a particular commit).
git commit -m "This is our first commit"
Follow this with another status report on our repository (git status), and you should be told that there is nothing more to commit, and the working directory is clean...
At this stage our local git repository is up to date, (and if you were just a lone developer using git for version control you'd be "done"). However our local git repository is still not "associated" with the remote repository we created on github, (git and github are different things so don't confuse them!).
To make that association between your local git repository and the remote repository, type the following at your command line, (your's will look slightly different depending on the name of the repository you created on github):
git add remote origin https://github.com/binarythistle/aggregator.git
TIP: Remember the kind info the folks at github gave you when you created your github remote repository (see above)? Well this just the 2nd to last line.
Finally, issue the "push" command to push your local git repository to your newly associated github repository:
git push -u origin master
You'll be asked to authenticate to github when you perform a remote push...
Once the push is finished you're done! Both repositories, (local git and remote github are in sync).