GitHub offers direct access to files in public repositories by using a link like https://raw.github.com/user/repository/branch/filename
. Using a link like this and CURL or WGET I may get a file in a public repository easily.
I recently moved some repositories I had at GitHub to BitBucket, since BitBucket offers me five private repositories for FREE, and FREE always seemed a lovely word for me. But it happens that I'm missing this feature in my public BitBucket repositories.
Is there a similar feature at BitBucket?
If so, what is the format of the URL to get a file?
it is easy to get plain text of any file using curl.
curl --user userName https://FQDN/repo_name/raw/fileName -o fileName
for example: URL for the target page in bitbucket: https://bitbucket.myDomain.com/projects/repos/repo/browse/myFile
will end with the following curl request: curl --user username https://bitbucket.myDomain.com/projects/repos/repo/raw/myFile -o targetFile
Yes. https://bitbucket.org/<account>/<repo-name>/raw/<commit-sha-or-HEAD>/<filename>
For this repo: https://bitbucket.org/pedrorijo91/hello-slick/src
Choose a a file (LICENSE for instance): https://bitbucket.org/pedrorijo91/hello-slick/src/fe7cfe392d8090fececdf481ba3a9270bbe678dd/LICENSE?fileviewer=file-view-default
and now click on the RAW button: https://bitbucket.org/pedrorijo91/hello-slick/raw/fe7cfe392d8090fececdf481ba3a9270bbe678dd/LICENSE
It seems bitbucket always adds a SHA before the file. You can specify the commit or HEAD seems to work also: https://bitbucket.org/pedrorijo91/hello-slick/raw/HEAD/LICENSE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With