Created
May 3, 2015 20:13
-
-
Save K3TH3R/0299fee2684e62fae8e3 to your computer and use it in GitHub Desktop.
Quickly setup Bitbucket/Github repos from your command line
This file contains 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
# New Github repo | |
# ----------------------------- | |
# Make sure to replace the "USERNAME" portion with your own | |
# GitHub username. To start a new public GitHub repo, | |
# simply do this from your command line: | |
# newgh REPO_NAME | |
function newgithub(){ | |
curl -u 'USERNAME' https://api.github.com/user/repos -d "{\"name\":\"$1\"}"; | |
git init; | |
git remote add origin git@github.com:USERNAME/$1.git; | |
echo "# $1" >> README.md; | |
git add -A; | |
git commit -m "Initial commit"; | |
git push -u origin master; | |
} | |
alias newgh=newgithub | |
# New Private BitBucket repo | |
# ----------------------------- | |
# Make sure to replace the "USERNAME" portion with your own | |
# BitBucket username. To start a new private Bitbucket repo, | |
# simply do this from your command line: | |
# newgh REPO_NAME | |
function newbitbucket(){ | |
curl --user USERNAME https://api.bitbucket.org/1.0/repositories/ --data is_private='true' --data name=$1; | |
git init; | |
git remote add origin https://USERNAME@bitbucket.org/USERNAME/$1; | |
echo "# $1" >> README.md; | |
git add -A; | |
git commit -m "Initial commit"; | |
git push -u origin master; | |
} | |
alias newbb=newbitbucket |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment