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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.