Skip to content

Instantly share code, notes, and snippets.

@jonbesga
Last active March 24, 2017 12:44
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 jonbesga/15e3ee11e5776fa947285f6e6b4240a7 to your computer and use it in GitHub Desktop.
Save jonbesga/15e3ee11e5776fa947285f6e6b4240a7 to your computer and use it in GitHub Desktop.
create_repo_and_first_commit
USER=jabesga
REPO_NAME=$(basename "$PWD")
DATA="{\"name\":\"${REPO_NAME}\"}"
echo "Creating repository ${REPO_NAME}"
curl --fail --silent -u $USER --data $DATA https://api.github.com/user/repos > /dev/null
echo "Initializing local git repository ${REPO_NAME}"
git init
echo "Adding remote"
git remote add origin git@github.com:$USER/$REPO_NAME.git
echo "First commit and push"
git add -A
git commit -m "first commit"
git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment