Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

[Bitbucket] Hyperlinking to source code in Bitbucket

As per the reference  for Bitbucket hyperlinking to source code, the url template is as follows. 

{+bitbucket}{/owner, repository_name}/src{/commitish}{/filepath}{?fileviewer}{#fileline}


The mandatory field owner is referred to as 'The account owner the repository that contains the target file'.  I've tried the admin user of the repository, however this does not work.  Is the owner field here the repository admin user or a different user?

The bitbucket version in use is v4.14.3


2 answers

1 accepted

0 votes
Answer accepted

Hi Prameesha,

The documentation you linked to is actually for Bitbucket Cloud, hosted at For Bitbucket Server, the URL structure is similar, but slightly different.

If the repository is part of a project, use the following structure:<PROJECT>/repos/<REPO_NAME>/browse/<FILE_PATH>/<FILE_NAME>#<LINE_NUMBER>

If the repository is under a user, use the following structure:<USER>/repos/<REPO_NAME>/browse/<FILE_PATH>/<FILE_NAME>#<LINE_NUMBER>

Hi Jeff, 

This works perfectly. However this always points to the source in the  master branch. If I were to access the source in the develop branch how should I go about it?



Jeff Thomas Atlassian Team Aug 29, 2017

Hi Prameesha,

After the <FILE_NAME>, you can add "?at=<BRANCH> to specify the branch you want.<PROJECT>/repos/<REPO_NAME>/browse/<FILE_PATH>/<FILE_NAME>?at=<BRANCH>#<LINE_NUMBER>

Hi Jeff, 

I used the following but this does not give me any results. It just shows me the entire source file but not the corresponding line.<PROJECT>/repos/<REPO_NAME>/browse/<FILE_PATH>/<FILE_NAME>#<Line number.>?at=<branch>  

Jeff Thomas Atlassian Team Aug 30, 2017

Hi Prameesha,

The Community site truncated the URL, which made it a bit hard to read. The ?at=<BRANCH> should come before the line number. For example:


Is there any short way to point to current branch or current pull request, rather than mentioning the whole URL? Maybe something like 


0 votes
Ana Retamal Atlassian Team Aug 03, 2017

Hi Prameesha, a  repo can have several admins but that doesnt mean all of them are owners. The owner will be the creator of the repository. You can find who's the owner by navigating to the repo settings and clicking on User and group access.

Best regards,


Hi Ana,

I tried the same, however it gives me a URL not found exception. Is there any other configuration that needs to be enabled?



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,478 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you