Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Keeping Bitbucket URL constant/consistent

Pam Simek
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 17, 2023

Greetings!

For Bitbucket Cloud is it possible to keep the repo URL taxonomy consistent across versions?  Some setting that can be configured to pin this down to a consistent path across versions, for example: 

bitbucket.org/<org>/<repo>/src/<branch_name>/<file_path>

Thank you. 

1 answer

1 accepted

0 votes
Answer accepted
Oday Rafeh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2023

@Pam Simek 

In Bitbucket Cloud, the URL structure for accessing files in a repository is relatively consistent across branches. The only part that varies is the <branch_name> in the URL. To access a specific file within a branch, you can use the following URL structure:

https: //bitbucket. org/<org>/<repo>/src/<branch_name>/<file_path>

However, when browsing files in Bitbucket Cloud, the URL will also include a commit hash or a reference ID. This is to ensure that the content displayed is associated with a specific commit, even if the branch changes over time. The URL will look like this:

https: //bitbucket. org/<org>/<repo>/src/<commit_hash_or_reference_id>/<file_path>? at=<branch_name>

Unfortunately, there is no built-in setting in Bitbucket Cloud to change this behaviour or simplify the URL structure.

If you need a consistent URL format for automation or external tools, you can use the Bitbucket Cloud REST API. For example, to access a file in a specific branch, you can use the following API endpoint:

https: //api. bitbucket. org/2.0/repositories/<org>/<repo>/src/<branch_name>/<file_path>

Using the REST API ensures a consistent URL structure when accessing files in different branches.

Pam Simek
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 17, 2023

Thanks much Oday, much appreciated.  

Like Oday Rafeh likes this
Oday Rafeh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2023

You're more than welcome !!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events