Skip to content

Instantly share code, notes, and snippets.

@andineck
Last active September 2, 2015 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andineck/fa1931fd2ba7ef12029d to your computer and use it in GitHub Desktop.
Save andineck/fa1931fd2ba7ef12029d to your computer and use it in GitHub Desktop.
github: add repo via command line

github cmd

  1. how to create and init a git repository
  2. how to create and init a git repository for an organization
# create and init a git repository for an organization
# replace: USER, ORG, PASSWORD, REPO in this script
# cd into your development directory
# with a user repo
curl -u USER:PASSWORD https://api.github.com/user/repos -d '{"name":"REPO"}'
mkdir REPO && cd REPO
git init
touch readme.md
git add .
git commit -m initial
git remote add origin https://github.com/USER/REPO.git
git push -u origin master
# create and init a git repository for an organization
# replace: USER, ORG, PASSWORD, REPO in this script
# cd into your development directory
# org repo
curl -u USER:PASSWORD https://api.github.com/orgs/ORG/repos -d '{"name":"REPO"}'
mkdir REPO && cd REPO
git init
touch readme.md
git add .
git commit -m initial
git remote add origin https://github.com/ORG/REPO.git
git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment