Skip to content

Instantly share code, notes, and snippets.

@syranez
Forked from yefim/create-repo.sh
Created May 5, 2012 09:46
Show Gist options
  • Save syranez/2601228 to your computer and use it in GitHub Desktop.
Save syranez/2601228 to your computer and use it in GitHub Desktop.
Create a new GitHub repo and check the response.
#! /usr/bin/env bash
user="syranez"
directory="/dev/shm/json"
root_node="git"
read -s -p "GitHub password: " pass
response=$(curl -s -u "${user}:$pass" https://api.github.com/user/repos -d "{\"name\":\"$1\"}")
# from https://github.com/syranez/shell-json
php ./shelljson.php --root="${root_node}" --directory="${directory}" "${response}";
if [ ! $? -eq 0 ]; then
echo "error: $?";
exit $?;
fi
echo $(cat "${directory}/${root_node}/message");
git remote add origin git@github.com:${user}/$1.git
rm -r "${directory}/${root_node}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment