# Same remote for multiple repos

**URL:** <https://discuss.dvc.org/t/same-remote-for-multiple-repos/75>\
**Category:** Questions\
**Created:** [August 21, 2018, 12:16pm UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75 "2018-08-21T12:16:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ynop](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@ynop](https://discuss.dvc.org/u/ynop)\
**Post date:** [August 21, 2018, 12:16pm UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75/1 "2018-08-21T12:16:48Z")

</div>

Hi

I was wondering how the remote mechanisms work.  
Assuming I have two different DVC repos, that may use the same base dataset.  
Can I use the same remote for both of them, so the dataset is not stored twice?

This is strictly speaking not possible because of hashing collisions, is it?

Regards  
Matthias

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [August 21, 2018, 10:39pm UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75/2 "2018-08-21T22:39:27Z")

</div>

Hi @ynop !

Thank you for a great question! Sure, you can do that. If some file has a hash 123456 in one project, it is going to have the same hash in another project. Strictly speaking hash collisions are always a possibility simply because of the nature of hashes, but, as it is in many other scenarios, in our case they are pretty unlikely, since the data is pretty big and the number of data files is quite small when compared with git for example. So you are safe using the same repo to store data for different projects.

Thanks,  
Ruslan

---

<div class="post-metadata">

**Author:** ![eliangius](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eliangius](https://discuss.dvc.org/u/eliangius)\
**Post date:** [December 16, 2021, 11:33pm UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75/3 "2021-12-16T23:33:10Z")

</div>

To take the question a bit further…

Let’s say I have 2 git/dvc repositories: One creates versions of a remote stored artifact (such as an ML model) & the second just clones this same remote artifact to apply it (such as to get ML predictions). Is it possible to make `repo2` track the latest version made by `repo1`?

I can see how git committing `repo2/artifact.dvc` as a symbolic link to `repo1/artifact.dvc` would achieve this, but wondering if there’s a dvc native way that’s platform independent.

---

<div class="post-metadata">

**Author:** ![YanxiangGao](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@YanxiangGao](https://discuss.dvc.org/u/YanxiangGao)\
**Post date:** [December 17, 2021, 1:36am UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75/4 "2021-12-17T01:36:26Z")

</div>

To sync the two repo automatically? Because only the data files are tracked by dvc, all others including dvc configuration files are actually tracked by Git. So maybe what you need is to push after every git commit. If so a Git hook can help you achieve the goal.

> <https://stackoverflow.com/questions/7925850/how-can-i-automatically-push-after-committing-in-git>

---

<div class="post-metadata">

**Author:** ![eliangius](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eliangius](https://discuss.dvc.org/u/eliangius)\
**Post date:** [December 17, 2021, 2:07pm UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75/5 "2021-12-17T14:07:53Z")

</div>

Right, I should have mentioned that the desired tracking in `repo2` does not need to be on every commit of `repo1` but could be more sporadically & asynchronous, say on major releases of either repo.

The question is, how can one make `repo2`'s remote artifact dependency on `repo1` automatically aware of any new artifact versions whenever `repo2` is ready to pull the latests? Namely, how can I make `repo2/artifact.dvc` pointer file match that of `repo1/artifact.dvc`?

I suspect creating the `repo2/artifact.dvc` via the **dvc import** command is the way to do this?

---

<div class="post-metadata">

**Author:** ![YanxiangGao](https://avatars.discourse-cdn.com/v4/letter/y/f04885/32.png) [@YanxiangGao](https://discuss.dvc.org/u/YanxiangGao)\
**Post date:** [December 20, 2021, 2:28am UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75/6 "2021-12-20T02:28:24Z")

</div>

> [@eliangius](#):
>
> I suspect creating the `repo2/artifact.dvc` via the **dvc import** command is the way to do this?

Sorry for the late reply, `dvc import` of course is an option especially when `repo1` and `repo2` didn’t have the same contents. But you still need to use `dvc update` manually to make the data version synchronized.

---

<div class="post-metadata">

**Author:** ![eliangius](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eliangius](https://discuss.dvc.org/u/eliangius)\
**Post date:** [December 20, 2021, 2:19pm UTC](https://discuss.dvc.org/t/same-remote-for-multiple-repos/75/7 "2021-12-20T14:19:34Z")

</div>

Indeed: **dvc import** initially & later **dvc update** were just the commands I was looking for. Thanks!
