stefanbc
3/20/2015 - 7:42 PM

Create a repo on Github from the command line

Create a repo on Github from the command line

# replace james2doyle with your own github username
function git-create() {
  if [ $# -eq 2 ]; then
    # name of repo to be created
    PROJECTNAME="$1"
    DESCRIPTION="$2"
    POST="{\"name\":\"$PROJECTNAME\",\"description\":\"$DESCRIPTION\"}"
    curl –sS -u 'james2doyle' https://api.github.com/user/repos -d "$POST"
    git remote add origin git@github.com:james2doyle/$PROJECTNAME.git
    echo "remote origin added"
  else
    echo "Wrong number of Arguments. \$1 = Name and \$2 = Description"
  fi
}