0

Possible Duplicate:
Is it possible to create a remote repo on GitHub from the CLI without ssh?

Every time I create to a new repo on github, I need to firstly go to the github website to create a repository, then using command line to push my code to that repo on my own pc. Is that possible to create a new github repository all from command line without browser?

Community
  • 1
  • 1
steve zhou
  • 51
  • 4

1 Answers1

1

As stated by a recent change to the GitHub API, it's now possible to create and initialize a repo a the same time through your preferred shell.

"Today we’ve made it easier to add commits to a repository via the GitHub API. Until now, you could create a repository, but you would need to initialize it locally via your Git client before adding any commits via the API."

"Now you can optionally init a repository when it’s created by sending true for the auto_init parameter:"

curl -i -u pengwynn \
 -d '{"name": "create-repo-test", "auto_init": true}' \
 https://api.github.com/user/repos

This auto initialization feature also allows one to dynamically add a .gitignore file to the repository from the .GitHub .gitignore repository by passing the name of the template to the "gitignore_template" parameter of the curl request.

nulltoken
  • 64,429
  • 20
  • 138
  • 130