Created
November 17, 2010 17:25
-
-
Save Apreche/703685 to your computer and use it in GitHub Desktop.
Create a github repository from the current directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This will turn the current directory into a repo on Github | |
# Set the username and password as environment variables like so, in bashrc: | |
# export GITHUB_USER="User Name Goes Here" | |
# export GITHUB_TOKEN="API Token Goes Here" | |
CWD=`basename $PWD` | |
curl -F "login=$GITHUB_USER" -F "token=$GITHUB_TOKEN" https://github.com/api/v2/yaml/repos/create -F "name=$CWD" | |
REPO_URL="[email protected]:$GITHUB_USER/$CWD.git" | |
if [ ! -d $PWD/.git ]; then | |
git init | |
touch README | |
git add README | |
git commit -m "first commit" | |
fi | |
git remote add origin $REPO_URL | |
git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment