# What is best practices for using DBT and Git with multiple internal organizations.

**URL:** https://discourse.getdbt.com/t/what-is-best-practices-for-using-dbt-and-git-with-multiple-internal-organizations/13933
**Category:** In-Depth Discussions
**Created:** [June 24, 2024, 6:37pm UTC](https://discourse.getdbt.com/t/what-is-best-practices-for-using-dbt-and-git-with-multiple-internal-organizations/13933 "2024-06-24T18:37:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![msavage0507](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@msavage0507](https://discourse.getdbt.com/u/msavage0507)
#### Post date: [June 24, 2024, 6:37pm UTC](https://discourse.getdbt.com/t/what-is-best-practices-for-using-dbt-and-git-with-multiple-internal-organizations/13933/1 "2024-06-24T18:37:14Z")

</div>

When companies that have many internal organizations use dbt. Do they all work in the same repository so that they can keep all of the linage data. Or is there a way to work in separate repositories but still keep this lineage.

---

<div class="post-metadata">

### Author: ![Miroslaw](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Miroslaw](https://discourse.getdbt.com/u/Miroslaw)
#### Post date: [June 25, 2024, 10:51am UTC](https://discourse.getdbt.com/t/what-is-best-practices-for-using-dbt-and-git-with-multiple-internal-organizations/13933/2 "2024-06-25T10:51:26Z")

</div>

I would use each dbt run per project repository. Each repository you can define private and assign a group and roles individually. That way you can have data governance and assign product owner to each repository. This is kind of data mesh structure I guess. Also you can read about Data Vault concept.

---

<div class="post-metadata">

### Author: ![mmarcelo](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mmarcelo](https://discourse.getdbt.com/u/mmarcelo)
#### Post date: [July 1, 2024, 12:46pm UTC](https://discourse.getdbt.com/t/what-is-best-practices-for-using-dbt-and-git-with-multiple-internal-organizations/13933/3 "2024-07-01T12:46:00Z")

</div>

I’d like to hear more about this question. Let’s suppose we have different teams taking care of following business areas: sales and payroll. Adding to scenario, we might want to share master\_data between teams.

Now, let me expose my thouthgs:

1. create 3 environments named: prod\_sales, prod\_payroll, and prod\_master\_data. Each team will be able to run and test on their environment. Additionaly, each environ can be linked to a different branch on Git;
2. on database side, create 3 different schemas with read/write permission for each team. This will prevent someone on different team running/building something on someone else’s schema;
3. on Git side we could have 3 different branches, but I don’t know how to effectively segregate team access without adding complexity on Git

More on git side: Having different branches won’t prevent someone creating objects related to payroll and merging onto sales branch, but having isolated repos do. As side effect, it makes difficult to share master\_data between repos. I think that creating a rule on Git to only allow objecs on a given subfolder on each branch might work. Ex: only objects on subfolder ./sales would be commited on sales branch. Well, I’m not an expert on Git and not sure if this is possible.

Any thoughts ?

---

<div class="post-metadata">

### Author: ![zoyaadeel](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/zoyaadeel/32/4244_2.png) [@zoyaadeel](https://discourse.getdbt.com/u/zoyaadeel)
#### Post date: [July 11, 2024, 9:57am UTC](https://discourse.getdbt.com/t/what-is-best-practices-for-using-dbt-and-git-with-multiple-internal-organizations/13933/4 "2024-07-11T09:57:14Z")

</div>

Hello,  
I think all lineage data is kept together and easily accessible, providing a comprehensive view of data transformations and dependencies across the entire organization. Teams work in separate repositories but still maintain lineage data. This can be achieved by using dbt’s external dependencies feature, where each team’s repository includes dependencies on the models of other teams.

---

<div class="post-metadata">

### Author: ![msavage0507](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@msavage0507](https://discourse.getdbt.com/u/msavage0507)
#### Post date: [July 11, 2024, 3:10pm UTC](https://discourse.getdbt.com/t/what-is-best-practices-for-using-dbt-and-git-with-multiple-internal-organizations/13933/5 "2024-07-11T15:10:28Z")

</div>

Thanks I am going to look into that.
