Is there a way (ideally through the API) to copy a...
# help
s
Is there a way (ideally through the API) to copy a repository? I want to maintain history, but essentially create a fork
i
Hi Steve, can you give a bit more context about the use case? Specifically, why would a branch not be sufficient?
s
Technically branching is totally reasonable, but mainly: I have two teams, and didn’t want to show all the branches across the two teams in one repository. Also team B wants to diverge
main
quite a bit, and may not ever merge back in, but it would be nice to maintain the history instead of creating a new repo from scratch
i
Thanks. I think that can be achieved with lakeFS RBAC capabilities. i.e. each group can have visibility into their own path (branches).
i
Hey @Steve Willard, I think if you run 1.
lakectl refs-dump lakefs://<repo>
2.
lakectl repo create-bare lakefs://<new_bare_repo> s3://<same_storage_namespace>
3.
lakectl refs-restore lakefs://<new_bare_repo> --manifest <json_from_step_1>
the behavior you’ll get is as close to a fork as it gets. Some differences: 1. Data isn’t copied between the repos. The new repo will keep pointing at the old objects. New objects uploaded to the new repo will be available in the new storage namespace. 2. You can’t merge/move/rebase commits/branches between the repos. 3. It only work for committed objects. Uncommitted objects should be committed in order to be available in the new repo. Let us know if it worked as expected.
s
Oh great, thank you! I’ll try that out. I’ll also talk with the teams — I think it might be good enough to just copy the data into a new repo, and ditch the history.