Skip to content

Instantly share code, notes, and snippets.

@rorlab
Created March 13, 2016 00:40
Show Gist options
  • Save rorlab/9f18c097cdad69410c37 to your computer and use it in GitHub Desktop.
Save rorlab/9f18c097cdad69410c37 to your computer and use it in GitHub Desktop.
Shell script for making github repository and pushing source codes
#!/bin/sh
repo_name=$1
test -z $repo_name && echo "Repo name required." 1>&2 && exit 1
curl -u '[username]:[password]' https://api.github.com/user/repos -d "{\"name\":\"$repo_name\"}"
git init
git add .
git commit -m "initial commit"
git remote add origin "https://github.com/[username]/$repo_name.git"
git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment