Link latest file on Bitbucket Git repository

2019-02-01 02:52发布

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:

https://bitbucket.org/wordless/thofu-interpreter/raw/5bfc37864c5d/ThoFu%20Interpreter/ReadMe.txt

I tried to replace the revision number with tip and default, but it didn't work. Is there any way to get a permanent link to my latest files?

5条回答
Root(大扎)
2楼-- · 2019-02-01 03:32

Two ideas:

Use master in the url (this seems to work):

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 file with this syntax:

<<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.

查看更多
欢心
3楼-- · 2019-02-01 03:32

I am using master like this for the last zip file of the code :

https://bitbucket.org/MIUSER/MIREPO/get/master.zip

Where MIUSER is my user and MIREPO is the name of my app.

Hope that this works :D.

查看更多
我想做一个坏孩纸
4楼-- · 2019-02-01 03:36

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
查看更多
仙女界的扛把子
5楼-- · 2019-02-01 03:40

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.

查看更多
迷人小祖宗
6楼-- · 2019-02-01 03:51

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.

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').

查看更多
登录 后发表回答