How to use bitbucket repositories on

You can use arbitrary Git repositories with a BinderHub. Not just and Related to this a question came up on how to actually do it.

Duplicating my answer here to make it easier to find.

The repo in question is:

The launch link for it is:

and when you fill in the form it looks like this:

You need to explicitly specify the revision you want, you can’t write master for the “arbitrary git URL” mode as we have no way to resolve that “word” into a revision, which is what we need to check the build cache. For GitHub and GitLab there is a little bit of magic to talk to the respective APIs to resolve it first. Could add this for bitbucket as well if someone is interested enough to open a PR.

1 Like

One place you can get the ID for a particular commit is from a Bitbucket repo’s Commits page eg . The ID comes at the end of the URL for a commit. For example, the commit identified as f3ddb33 gives the link:

which gives the commit hash f3ddb33e4839f8a0fe73c168993b405adc13daf0 used in the demo above.

1 Like

git ls-remote can fetch sha1s without a local clone, e.g.:

$ git ls-remote
f3ddb33e4839f8a0fe73c168993b405adc13daf0        HEAD
8116559e4030d1d4f557617780410cbca7896663        refs/heads/canvas
d50105bacbb74ca139c5bf38ef1657190a006929        refs/heads/group
f3ddb33e4839f8a0fe73c168993b405adc13daf0        refs/heads/master
0b92e511ce8e04f26131efddde9b4a2f5ef9e1e1        refs/heads/multi-user
bc53e6aa12b6d7988de514c8c92e29877be5cc61        refs/heads/separate-modules
a1b2c3bcc2e563afbd335013805d19c95d67224d        refs/heads/server-side-refactor
$ git ls-remote master
f3ddb33e4839f8a0fe73c168993b405adc13daf0        refs/heads/master

This might provide a generic alternative to using provider specific APIs?

1 Like

Nice! Could you open an issue on with the git ls-remote idea?

We could already add this to the “bare git repo” provider


1 Like