tags:

views:

46

answers:

2

I did:

~$ mkdir projectname
~$ cd projectname
~$ git init
~$ touch file1
~$ git add file1
~$ git commit -m 'first commit'

So... Is there any git command to create a new remote repo and push my commit to GitHub from here? I know it´s no big deal to just fire up a browser and head over to Create a New Repository but if there is a way to achieve this from the CLI I would be happy.

I read a vast amount of articles but no one that I found mention how to create a remote repo from the CLI using git commands. Tim Lucas nice article Setting up a new remote git repository is the closest I get but GitHub does not provide shell access.

I guess what I look for is something equivalent to the HTTP Put but for Git/GitHub =P

DISCLAIMER: Started fiddling with Git five days ago so bare with me if it´s a newbie question =)

Thanks i advance fellow SOers!

A: 

You can create push by HTTP in git specification. But Github don't acces to that.

shingara
+2  A: 

You can create a GitHub repo via the command line using the GitHub API. Check out the repository API. If you scroll down about a third of the way, you'll see a section entitled "Creating and Deleting Repositories" that explains how to create a repo via the API (right above that is a section that explains how to fork a repo with the API, too). Obviously you can't use git to do this, but you can do it via the command line with a tool like curl.

Outside of the API, there's no way to create a repo on GitHub via the command line. As you noted, GitHub doesn't allow shell access, etc., so aside from the GitHub API, the only way to create a repo is through GitHub's web interface.

mipadi
Thanks a bunch mipadi! Didn´t know about the GitHub API. For everyone else with the same problem, this is what i basicly did: `curl -F 'login=username' -F 'token=API Token' https://github.com/api/v2/yaml/repos/create -F name=reponame`. Your API Token can be found on the GitHub site, click *Account Settings*, look for *Administrative Information* and *API Token* (32 character long string).
anddoutoi