git BitBucket - 以 ZIP 格式下载源代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13044749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:49:09  来源:igfitidea点击:

BitBucket - download source as ZIP

gitdownloadzipbitbucketgit-clone

提问by user984621

I know I can get the project through git clonecommand, 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.

我知道我可以通过git clone命令获取项目,但是有什么方法可以通过 Web 界面从BitBucket.org下载项目?以最好的方式,我正在寻找一种将项目源下载为 ZIP 压缩文件的方法。

回答by Pigueiras

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

对于最新版本的 Bitbucket (2016+),可以在下载菜单项中找到下载链接。

enter image description here

在此处输入图片说明



Pre-2016

2016 年之前

First method

第一种方法

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

在 repo 的概述页面中,有一个下载项目的链接。

Direct download of a repo

直接下载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:

转到下载 -> 分支 -> 下载所需的分支(如 .zip、.gz 或 .bz2)。在那里你会找到所有标签的下载链接。链接将采用以下格式:

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

回答by eirenaios

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.

然后只需单击具有下载图标的下载选项卡。它将让您以zip 格式下载整个存储库。

enter image description here

在此处输入图片说明

回答by seddonym

For gitrepositories, to download the latest commit, you can use:

对于git存储库,要下载最新的提交,您可以使用:

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

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

For mercurialrepositories:

对于mercurial存储库:

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

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

回答by A.G

Direct download:

直接下载:

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

从 bitbucket 的仪表板转到项目存储库。从左侧菜单中选择下载。选择下载存储库。

enter image description here

在此处输入图片说明

回答by Vatsal Shah

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.

下载特定分支 -从左侧面板转到下载,在下载页面上选择分支。它将列出所有可用的分支。以 zip、gz 或 bz2 格式下载所需的分支。

enter image description here

在此处输入图片说明

回答by Rubanov

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

Bitbucket Server 中,您可以通过单击...分支旁边的 进行下载,然后Download

Bitbucket Server download

比特桶服务器下载

For more info see Download an archive from Bitbucket Server

有关更多信息,请参阅从 Bitbucket Server 下载档案

回答by Hein Andre Gr?nnestad

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.

我试图弄清楚是否可以像在 GitHub 上一样浏览早期提交的代码,它把我带到了这里。我使用了我在这里找到的信息,在摆弄了 url 之后,我实际上也找到了一种浏览旧提交代码的方法。即使问题/答案是关于下载较早提交的代码,我想我也只是添加一个浏览代码的答案。

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

当您浏览代码时,URL 类似于:

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.

您可以在提交时浏览代码。我不明白为什么没有直接选择提交的下拉框,该功能已经存在。奇怪的。

回答by Eugen Mihailescu

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

如果你想从你的 shell/终端下载 repo,它应该像这样工作:

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

or whatever download URL you might have.

或您可能拥有的任何下载 URL。

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

请确保 user:password 都是URL-encoded。因此,例如,如果您的用户名包含该@符号,则将其替换为%40.