Is it possible to create a new repository in Bitbucket by using command line Git? I have tried the following:
git clone --bare https://username@bitbucket.org
Here is @hannesr's script tweaked a bit to accept input from prompts:
# startbitbucket - creates remote bitbucket repo and adds it as git remote to cwd
function startbitbucket {
echo 'Username?'
read username
echo 'Password?'
read -s password # -s flag hides password text
echo 'Repo name?'
read reponame
curl --user $username:$password \
https://api.bitbucket.org/1.0/repositories/ \
--data name=$reponame \
--data is_private='true'
git remote add origin git@bitbucket.org:$username/$reponame.git
git push -u origin --all
git push -u origin --tags
}
You should place this in your .bashrc
or .bash_aliases
.