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
I've made a slight modification to @pztrick above script. This new script should work the same, but it uses the newer 2.0 API:
function startbitbucket {
echo 'Username?'
read username
echo 'Password?'
read -s password # -s flag hides password text
echo 'Repo name?'
read reponame
curl -X POST -v -u $username:$password -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/$username/$reponame \
-d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }'
git remote add origin git@bitbucket.org:$username/$reponame.git
git push -u origin --all
git push -u origin --tags
}
You can place this in your .bashrc or .bash_aliases file (just like the original script).
Note that it will also create this as a private repo. You can change "is_private": "true" to "is_private": "false" to make it a public repo.