Last Updated: December 26, 2018
·
1.444K
· viatropos

Create a GitHub repo from the command line

Add this to your ~/.bashrc:

gitinit() {
  git init
  git add .
  git commit -am "init"
  git remote add origin git@github.com:$1/$2.git
  curl -u 'USER' https://api.github.com/orgs/$1/repos -d "{\"name\":\"$2\"}"
  git push -u origin master
}

alias gitinit=gitinit

2 Responses
Add your response

If you're unfamiliar you might find "hub" from GitHub useful. It lets you do this and much more: https://github.com/github/hub

over 1 year ago ·

+1 hub

over 1 year ago ·