链接 Bitbucket Git 存储库上的最新文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11692124/
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
Link latest file on Bitbucket Git repository
提问by Thomas Uhrig
I have a public Git repository on Bitbucket. I want to link the latest version of a Read-Me file. Here's the link to a revision/commit:
我在 Bitbucket 上有一个公共 Git 存储库。我想链接最新版本的自述文件。这是修订/提交的链接:
https://bitbucket.org/wordless/thofu-interpreter/raw/5bfc37864c5d/ThoFu%20Interpreter/ReadMe.txt
https://bitbucket.org/wordless/thofu-interpreter/raw/5bfc37864c5d/ThoFu%20Interpreter/ReadMe.txt
I tried to replace the revision number with tipand default, but it didn't work. Is there any way to get a permanent link to my latest files?
我试图用tip和default替换修订号,但没有用。有什么办法可以永久链接到我的最新文件吗?
回答by Sunil D.
Two ideas:
两个想法:
Use master
in the url (this seems to work):
master
在 url 中使用(这似乎有效):
https://bitbucket.org/wordless/thofu-interpreter/raw/master/ThoFu%20Interpreter/ReadMe.txt
Another idea is to create a wiki page for your project, then use the wiki's functionality to link to the latest version of a filewith this syntax:
另一个想法是为您的项目创建一个 wiki 页面,然后使用 wiki 的功能通过以下语法链接到文件的最新版本:
<<file path/to/file [revision] [linenumber]>>
Just omit the revision and line number parameters, they are optional.
只需省略修订版和行号参数,它们是可选的。
Then, refer to the wiki page everywhere else you'd like link to the read me file.
然后,在您想要链接到自述文件的任何其他地方参考 wiki 页面。
回答by a-fro
There is an easy workaround for this issue by updating your relative links to src/[branch_name]/path/to/file
. Works like a charm for me.
通过将您的相对链接更新到src/[branch_name]/path/to/file
. 对我来说就像一种魅力。
回答by Dymos
The canonical way to add a link to a file in your repository using Markdown (the default for Readme files and Wiki pages) is by linking to the relative path of the file.
使用 Markdown(自述文件和 Wiki 页面的默认设置)向存储库中的文件添加链接的规范方法是链接到文件的相对路径。
For example, if I had a structure like so:
例如,如果我有这样的结构:
<repo root>
|-- my-file.txt
|
|-- my-dir
| |-- my-other-file
I'd be able to link to them as follows:
我可以按如下方式链接到它们:
[my-file](my-file.txt)
[my-dir](my-dir)
[some-other-file](my-dir/some-other-file)
Bitbucket will then automatically link to the file at the current branch that you are viewing the file at. If you're viewing the Readme file in the overview that will mean the default branch (usually 'master').
然后 Bitbucket 将自动链接到您正在查看文件的当前分支上的文件。如果您在概览中查看自述文件,则表示默认分支(通常是“master”)。
回答by bjorkblom
Here are working links:
以下是工作链接:
RAW:
生的:
https://bitbucket.org/wordless/thofu-interpreter/raw/HEAD/TODO.txt?at=master&fileviewer=file-view-default
Source:
来源:
https://bitbucket.org/wordless/thofu-interpreter/src/HEAD/TODO.txt?at=master&fileviewer=file-view-default
回答by CTala
I am using master like this for the last zip file of the code :
我正在将这样的 master 用于代码的最后一个 zip 文件:
https://bitbucket.org/MIUSER/MIREPO/get/master.zip
Where MIUSER is my user and MIREPO is the name of my app.
其中 MIUSER 是我的用户, MIREPO 是我的应用程序的名称。
Hope that this works :D.
希望这有效:D。