Hi There,
I'd like to clone the contents of one bitbucket project to another project. Is this feature available at this stage? Please let me know.
Regards,
Carthik
Hello @Carthik Annayan,
Before I answer your question I'd want to confirm I understood it correctly.
Do you mean cloning contents of a single repository or a project, which is essentially a group of repositories? Just wondering whether you referenced a repository as a "project".
Cheers,
Daniil
Hi Daniil,
I have many repositories in a single project. Precisely, I'd like to clone the contents of one project to another. Your understanding of my question seems to be partially correct. I wanted to clone the Contents of a "PROJECT" to a "NEW PROJECT" this should include all the repositories within the project.
You help and any quick response is much appreciated. Also, the bitbucket documentation is not very helpful to identify the API's to be used.
Regards,
Carthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the clarification.
Unfortunately, there's no option of batch copying of all repositories within a project into another project as this use case doesn't look common. You can only copy repositories one by one. I can think of two options:
Hope this helps.
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniil,
Thanks for your quick turn around. We have a list of projects and the structure is messed up. We like to use your API's/bash script to achieve the following
1. Create a Project using API
2. List the contents of an existing project using API/git command
3. Clone the repos one by one from the existing project using API/git command
4. Change the remotes for all the repos using API/git command
5. Push all the repo's to the new project using API/git command
Your help in this regard is much appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Carthik Annayan,
Unfortunately, step 4 (change remotes) won't work as the repository clone URL doesn't have project in it, only workspace and repository slug.
Is your final goal to copy or actually move repositories from one project to another?
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniil,
Yes, that's correct. But we have 24-28 such Projects which I'd like to move an organized in a structured manner. May be steps 5 and 4 should be interchanged? your thoughts and ideas are most welcome.
I look forward to hearing from you.
Cheers,
Carthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Carthik Annayan,
I understand what you're trying to achieve, however I'm afraid there's no good way of automating this process.
As I said, you can't copy or move a repo from one project to another by cloning and then pushing it up again – because the clone URL does not include project, projects are server-side entities used for grouping repositories. That said, clone URL does not change if you move a repo from one project to another. So step 4 won't work because the clone URL remains unchanged, hence step 5 is a no-op.
What you can do is go to the repository settings UI and change the project that repository belongs to, but this is manual per-repository process, the only thing that you can automate is prepare go-to links for every repository.
Unfortunately I'm not aware of any API that could help with moving repositories around, sorry.
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniil,
Thanks for your response. I'm surprised and disappointed that we can't automate this. Having said that, can you point us to the actual payload, API to create a Project for bitbucket API Version 1
Regards,
Carthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Carthik Annayan,
Here's the document describing the endpoint to create a project. Note that it is a v2 endpoint, because v1 API has been deprecated about a year ago and removed recently, check out details on this.
Hope this helps.
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.