Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is it possible to decipher the repo url from the tag or commit url of any bitbucket repository

PravinG74
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!
May 28, 2024

I have a use case where I need to clone the particular tag or commit using the URL ofo that tag or commit or branch. I have seen multiple instances of bitbucket (on cloud, on prem) I see that there is no single pattern in the URLs here are few examples  I know.

 

https://bitbucket.org/PravinG74/test2/commits/2aa5055f37a764986faaf95dd2c23ad114a951c6

https://bitbucket.org/PravinG74/test22/branch/patch1

https://bitbucket.org/PravinG74/test22/src/patch1/

 

Out of these URL, I need to identify the repo URL so that I can clone it using JGit.

1 answer

1 vote
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2024

Hey @PravinG74 ,

Welcome to the Atlassian Community.

Wouldn't it be easier to use the Bitbucket REST API to get this information instead of trying to parse it from the URL?

Check out the documentation here: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-get

Cheers,
Peter

Suggest an answer

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

Atlassian Community Events