Create new Bitbucket repo on command line

My usual process when starting a new project in web development is to

  1. Create a new private repository at Bitbucket
  2. Add the remote url to my local repo
  3. Git push to remote

This involves a lot of context-switching by using a browser, remembering logins, clicking and copy-pasting stuff. It adds a lot of friction when starting a new project.

I decided to scratch my itch, make the process easier. I created a batch script that’s aliased to bitbucket command. It will ask my username, password, and a repo name. After that it creates it using Bitbucket REST APIs and adds the resulting repo to the remote of the current git repo.

It’s much simpler than it sounds haha. Here it is:

[gist id=6687a9676dedd47698a7]

Now I just need to type bitbucket and answer the prompt and the code will be ready to be pushed to it’s own repo. :)

2020 © Jerico Aragon