Best way to clone a repo to a new one with the REST API?

Hello,

I am working on a project where I have complete end-to-end gitOps deployment through the REST API. I need to be able to clone a project repo from a template to another project from the REST API. From reading the documents for the API:

What is not clear to me is what type can I specify to just clone all of the files from one project to another new one from the template?

Hi @csmykay, welcome to the forum :tada:

I’m not sure familiar with the Project templates API, but it sounds like you might need a combination of that and the Project import / export API in order to retrieve a specific template repo and import it to another project.

Hopefully, that helps :slight_smile:

1 Like

Thank you @sugaroverflow! That type of API would mean I would have to download the file, then re-upload it with an import. Now that I am re-reading the feature list perhaps just doing a bulk import will work.

This looks like I can specify the path to one git URI to another. Just have to create my new git project and git the URI for it and pass it in the dest for the bulkimport.

I don’t see any examples of it out there so I guess I will have to do some trial and error with this API.

1 Like

Oh, I’m glad you found that the Bulk Imports API works better for your use case @csmykay!

I tried to see if I could find some examples or a blog post using this API, but wasn’t able to find anything specific. Feel free to share your work as you’re figuring things out and we can try to help! :slight_smile: