I have a requirement in which my client is required to clone the repository on the client machine. The repositories can be of Git/GibLab or BitBucket. From each of the URLs I need to get the repo URL so that I can clone the repo. Ideally I don’t need complete repo, even if I can just clone the tag or branch or commit, it will suffice. However I couldnt find any API which will parse the URL for the tag or commit and give me the repo URL which is must for JGit. If there is any API by which I can clone any of the object mentioned below, that will suffice my need.
https://bitbucket.org/user123/test2/commits/2aa5055f37a764986faaf95dd2c23ad114a951c6
https://bitbucket.org/user123/test2/branch/master
http://gitlabsrv/gitlab/wgdz0e/gitImportUpdateExportTests/commit/3684323fb8aeb7dbe5098b77e68d08b515fd475e
I have tried parsing the URL, however I am encountering various pattens of the URL as you can see from my original question. This is very specific to each repository how its configured. In case of bit bucket cloud based solution (free) has one format and the paid subscription has different format. Therefore its difficult to provide generic support for this use case, therefore looking for any API which will take the tag or commit url and provdie he base url of the repo.