Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create a GitHub repo from the CLI (plus bash function)

Create GitHub repo without leaving the command line

curl -u 'USER' -d '{"name":"REPO"}'

Replace USER with your username and REPO with the intended repo name. Include all quotes above.

The do the usual:

git remote add origin
git push origin master

Woo Hoo! Now, to betterize it...

Bash function for this:

function gh-new () {
  curl -u 'USER' -d "{\"name\":\"$1\"}"

Again, replace USER when you use it in your own .bash_profile.

usage: $ gh-new repo-name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.