Skip to content

Instantly share code, notes, and snippets.

@jonbesga
Last active March 24, 2017 12:44
Show Gist options
  • 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 [email protected]:$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