BitBucket - download source as ZIP
Asked Answered
L

8

282

I know I can get the project through git clone command, but is there any way, how to download the project through the web interface from BitBucket.org? In the best way, I am looking for a way to download a project source as ZIP compress file.

Loquat answered 24/10, 2012 at 7:38 Comment(2)
after trying alot of download managers, use firefox download them all it gives you the maximum download speed , and dose not interrupt for no reason , on bitbucket i had tens of branches and its fastDigest
How to download a single file?Hairworm
H
427

For the latest version of Bitbucket (2016+), the download link can be found in the Download menu item.

enter image description here


Pre-2016

First method

In the Overview page of the repo, there is a link to download the project.

Direct download of a repo


Second method

Go to Downloads -> Branches -> Download the branch that you want (as .zip, .gz or .bz2). There you'll find download links for all tags. The links will be in the format:

https://bitbucket.org/owner/repository/get/v0.1.2.tar.gz

By tweaking it a little bit, you can also have access to any revision by changing the tag to the commit hash:

https://bitbucket.org/owner/repository/get/A0B1C2D.tar.gz
Headward answered 24/10, 2012 at 7:41 Comment(8)
Is it possible to download a commit other than the most recent one?Hoofbound
@DiegoHerranz You can't download all the commits but you can download also the tagged ones.Headward
Despite having no button, you can actually download ANY commit, just use an url like this: https://bitbucket.org/owner/repository/get/A0B1C2D.tar.gz, changing the owner, repository and revision hash. Check this answer for more details.Weizmann
@Rudy Really nice find! Could you edit my answer with that information? I would do it myself but I can't right now :)Headward
"missing" download button... the reason why github.com is used more?!Charissacharisse
@RudyMatela and Pigueriras - this solution saved my bacon today. I had a commit that was in a bizarre branch that'd been deleted about a month ago. Luckily I had the SHA1 of the commit and was able to get it. You guys rock.Kaveri
Thanks, this was exactly what I needed. I used this in lieu of cloning a repo and copying it to a new repo as I didn't need to preserve commit history.Annelleannemarie
Any way to customize the filename being proposed? The default {owner}-{reponame}-{commit}.zip doesn't suit my needs. Any way to limit to {reponame}.zip only?Torhert
N
157

Now Its Updated and very easy to download!

Select your repository from Dashboard or Repository tab.

And then just click on Download tab having icon of download. It will Let you download whole repository in zip format.

enter image description here

Nyctalopia answered 2/8, 2014 at 8:25 Comment(5)
I have to say that they updated the page and they removed the "Download" link from the main repository view. Someone should send them a link to this SO question ...Headward
Unfortunately, a straight-forward way to download an old revision is still missing in their UI. Still have to use second method mentioned in @Headward solution.Indictable
What about a way to download all repos for a project? i.e. I would like a folder with the project name, with nested folders for each repo...Quixotism
This should be the new accepted answer but I think the OP is no longer on SOArturoartus
@ZachSmith you need to use their REST API to get a list of each repository and its clone URL, then clone each one.Histopathology
C
26

For git repositories, to download the latest commit, you can use:

https://bitbucket.org/owner/repository/get/HEAD.zip

For mercurial repositories:

https://bitbucket.org/owner/repository/get/tip.zip

Cloth answered 10/3, 2014 at 16:10 Comment(5)
This doesn't work. The way to do this is: bitbucket.org/owner/repository/get/tip.zipExtension
It certainly works for me, I just tried it again. But perhaps yours is the documented way to do it?Cloth
I just tried again and bitbucket responds with 404 to the /get/HEAD.zip, but properly gives a download link for /get/tip.zipExtension
You're right - it did used to work but they've changed things over at Bitbucket. I've edited the answer.Cloth
actually it works for me with HEAD.zip. May it makes a difference if the repo is using git vs. hg? For git HEAD.zip works and I suspect tip.zip is the right thing for hg repos.Hugo
N
11

In Bitbucket Server you can do a download by clicking on ... next to the branch and then Download

Bitbucket Server download

For more info see Download an archive from Bitbucket Server

Nepos answered 1/8, 2017 at 7:50 Comment(3)
I don't see the "download" item in the menu. Is there a way to add/active it?Tripetalous
You probably have an older version of Bitbucket Server. We have 5.1.0 and it is working there.Nepos
2022, version 7.19 and still works perfectly fine :)Doctrinaire
T
8

Direct download:

Go to the project repository from the dashboard of bitbucket. Select downloads from the left menu. Choose Download repository.

enter image description here

Teniacide answered 30/6, 2017 at 7:36 Comment(1)
Particularly noteworthy in my opinion is the "Tags" tab. This contains the zip/gz/bz2 links which point to specific tags. Useful when added a package to PyPI, for example.Ensconce
B
6

To Download Specific Branch - Go To Downloads from Left panel, Select Branches on Downloads page. It will list all Branches available. Download your desired branch in zip, gz, or bz2 format.

enter image description here

Bywoods answered 12/4, 2018 at 16:40 Comment(0)
F
4

I was trying to figure out if it's possible to browse the code of an earlier commit like you can on GitHub and it brought me here. I used the information I found here, and after fiddling around with the urls, I actually found a way to browse code of old commits as well. Even though the question/answer is about downloading the code of an earlier commit, I thought I'd just add an answer for browsing the code also.

When you're browsing your code the URL is something like:

https://bitbucket.org/user/repo/src/

and by adding a commit hash at the end like this:

https://bitbucket.org/user/repo/src/a0328cb

You can browse the code at the point of that commit. I don't understand why there's no dropdown box for choosing a commit directly, the feature is already there. Strange.

Forzando answered 13/8, 2013 at 11:49 Comment(0)
P
3

In case you want to download the repo from your shell/terminal it should work like this:

wget https://user:[email protected]/user-name/repo-name/get/master.tar.bz2

or whatever download URL you might have.

Please make sure the user:password are both URL-encoded. So for instance if your username contains the @ symbol then replace it with %40.

Placentation answered 5/6, 2018 at 17:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.