You must do something on GitHub, to create the repository there. This can be as simple as telling GitHub "create an empty repository under my GitHub account", but there's no Git command to do this: GitHub require you to access some web on their site, set some parameters, and send a request.
You can do this through the curl
program, if you have that installed. See, e.g., https://gist.github.com/btoone/2288960. If you don't have curl
installed, most modern programming languages have packaged routines for doing web operations (e.g., Python's requests
library), but it will usually take at least a few lines of code.
Once the GitHub-side repository exists—you can create this at any point, before or after doing command-line commands to create and manipulate your local repository—it's just a matter of telling your local repository how to access the GitHub repository:
git remote add origin ssh://git@github.com/your-account/your-repo.git
for instance, assuming you'd like to use the standard name origin
. Then:
git push origin master branch1 branch2
or:
git push --all origin
will send the appropriate commits and ask the Git repository at GitHub to set its branch name(s) as requested on the command line.