For reasons completely unknown I find it *really* difficult to
remember the syntax in Git to push a new local repository to a
remote destination.
So to stop from scratching my head about it, I am going to put
it here. Two reasons:
1. so I know I can find it
2. it might help someone else looking for it
So, you've create a local git repository on your machine
and what to push it to a remote server? (In this example I am going
to use http://BitBucket.org)
Firstly, log in to BitBucket and create a new blank
repository.
Once that is done, using git bash in your local
repository execute the command
git remote add origin git@bitbucket.org:{BITBUCKET_USERNAME}/{REPO_NAME}.git
Obviously, replacing
{BITBUCKET_USERNAME} & {REPO_NAME} with the real
values!
This will add the the BitBucket
URL as a local remote alias called "origin" to your local
repo.
Now you need simply need to push
your local repository (usually called master)
to your remote repository. Which is called origin
as we have just given it that alias!
To be clear, you can call your
remote alias anything you like it doesn't have to be
origin. In this instance calling your alias
bitbucket would make sense.
git push origin master
And that is all you need to do! Really simple but for some
reason I can never remember it.
As a side note, there is also a really handy git reference guide
on GitHub