I’ve been using my dbt cloud trial for a couple weeks now and I’ve been learning a lot. I’m connected to a snowflake trial and I’ve set up several models and deployed them to production without any issues.
I’m now trying to get practice and gain a better understanding of git. I created a GitHub account and a repository. In my dbt account, I linked the GitHub account and it shows up under linked accounts.
I believe I now need to initialize my dbt project into GitHub, but I don’t know how to do that.
Google tells me..
Initialize a Local Git Repository (if not already done):
- Open your terminal or command prompt.
- Navigate to the root directory of your dbt project.
- If you haven’t already initialized a Git repository in this directory, run: git init
I understand how to change directories in the command line, but where exactly is my root directory for my dbt project? I’m not clear on this since I’ve only been working directly in dbt cloud.
I’m running into some dead ends trying to figure this out on my own. I would be grateful for any help on this topic! Thank you.
You have to link the project to git
The link account means link dbt cloud account to github
Note: @keith_fajardo originally posted this reply in Slack. It might not have transferred perfectly.
So I decided to delete the first project I set up in dbt, and then re create a project, I was able to link my GitHub from there. I didn’t have a GitHub account when I created my first project in dbt, so that is a little perplexing that I had to re create a project to do it. Anyway, I have what I need now, although it seems I can’t approve my own PR in GitHub, so I can’t really do much with GitHub since these are my own personal trial accounts.
I’m not sure exactly what was going on, but I can address a thing or two:
Your root directory for your project would be where your dbt_project.yml file lives, along side all the other dbt folders. So, if you dbt_project.yml file lives at Users/myprojects/my_dbt_project/dbt_project.yml, then the my_dbt_project folder is your root folder for the project.
I don’t have much experience with it, but I believe with the dbt Cloud trial, if you don’t create your git repository yourself, it hosts it for you remotely. With that, I’m not sure there would be a way to copy all those files into your own git repo, hence you having to create the project over again.
Finally, while you can’t approve your own PRs in GitHub, you can create them and then merge them yourself without approval (unless you added some restrictions for PR approvals in the repository settings). However, you can also just bypass the PR process altogether and do a branch merge. I’m not sure you can do that with the dbt Cloud interface, so you might have to clone the git repo locally and learn how to merge branches yourself (things like GitHub Desktop can make this easier, though may not teach you as much as using the command line).