Skip to content

Instantly share code, notes, and snippets.

@bonelifer
Forked from igk1972/github_repo_create.sh
Created September 3, 2020 19:46
Show Gist options
  • Save bonelifer/9819ecdce28ecf32183f3392de5dc4f9 to your computer and use it in GitHub Desktop.
Save bonelifer/9819ecdce28ecf32183f3392de5dc4f9 to your computer and use it in GitHub Desktop.
Github repo create
#!/bin/sh
# [ -z "$1" ] || ACCESS_TOKEN="$1"
[ -z "$1" ] || ACCESS_AUTH="$1"
[ -z "$2" ] || REPO_NAME="$2"
# [ -z "$ACCESS_TOKEN" ] && { echo "Token not set" ; exit 1; }
[ -z "$ACCESS_AUTH" ] && { echo "Username[:Password] not set" ; exit 1; }
[ -z "$REPO_NAME" ] && { echo "Repo not set" ; exit 1; }
# curl -s -L -H "Authorization: token $ACCESS_TOKEN" --data \
curl -s -L -u "$ACCESS_AUTH" --data \
\
"{\"name\":\"$REPO_NAME\",\"private\":true,\"has_issues\":false,\"has_projects\":false,\"has_wiki\":false}" \
\
"https://api.github.com/user/repos"
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment