#type/zk/zettel
# [[How I use Git for my Obsidian vault]]
I use [[git-crypt]] to encrypt the repository. That allows me to push it to [[GitHub]] without having to worry too much about privacy.
I use [[Obsidian Git]] to make automatic commits.
[[Obsidian Git]] (probably) doesn't support git-crypt on mobile, due to limited Git implementation [[isomorphic-git]]. So I use [[Entries/iCloud]] to synchronize to my mobile devices.
One problem is that iCloud doesn't work so well with `.git` folders, though, so I needed a solution for that. [[Git Worktree]] directories only have a single `.git` file that points to the original git directory, and this file basically remains unchanged. So what I do is that I have my full repository somewhere outside of iCloud, and then created a worktree inside of iCloud for the `main` branch. This solves the iCloud problem.
```
git worktree add "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Personal Obsidian" main
```
In order to create a worktree with a git-crypt repo, I need to first `git-crypt lock` before doing `git worktree add`.
---
Sources::
Continuation::
Branches::
See also::
Further reading::