Skip to content

Instantly share code, notes, and snippets.

@faroit
Last active May 13, 2016 13:54
Show Gist options
  • Save faroit/013613f5f3faf2e0876c56a308d0663b to your computer and use it in GitHub Desktop.
Save faroit/013613f5f3faf2e0876c56a308d0663b to your computer and use it in GitHub Desktop.
USER=your_github_username
# Create a token via commandline
# curl -u "$USER" -d '{"scopes":["repo"],"note":"migrate.sh"}' https://api.github.com/authorizations
TOKEN=yourtoken
REPONAME=${PWD##*/}
# Create repository and return the git url
URL=$( curl -v -XPOST -H "Authorization: token $TOKEN" https://api.github.com/user/repos \
-d "{ \"name\": \"$REPONAME\", \"private\": true }" | jq '.ssh_url' | sed 's/\"//g' )
echo "$URL"
# add remote 'gh' to repo
git remote add gh "$URL"
git push gh --all
git push gh --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment