Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to set --git_dir? #414

Closed
zfei opened this issue Jan 5, 2023 · 4 comments
Closed

Is there a way to set --git_dir? #414

zfei opened this issue Jan 5, 2023 · 4 comments

Comments

@zfei
Copy link

zfei commented Jan 5, 2023

I have a setup of syncing obsidian repos between Mac and Win via iCloud Drive.
Initially, I put the .git in the root dir of the obsidian repo, but iCloud always messes up the objects in .git when I switch OS.

Now I'm thinking of having a git directory for each machine locally that's not synced by iCloud, and have a host specific --git_dir for the plugin to pass to git binary.

Going through the current plugin setting scheme, I guess adding a GIT_DIR env var into the "Additional PATH env var paths" could help? Yet when I tried it out on Windows, it looks like the plugin tries to split the : in my disk reference, i.e. D:\.

Is the PATH field a right fit for my use case? If so, how do I set it on WIndows?

Thanks in advance.

@erauner12
Copy link

+1 I would like to do this as well.

Though I want to point obsidian-git plugin at --git-dir=.gitContent for the purpose of having a separation of revision history to .md content and obsidian vault files

@narze
Copy link

narze commented Jan 15, 2023

I found a workaround using plaintext .git file similar to this issue #55
however I cannot use ~ to direct it to my home directory so I use relative path to the vault path in iCloud

Assuming that your .git is at ~/obsidian.git, create .git file with this content:

gitdir: ../../../../../obsidian.git

If all of your machines share the same username you can use absolute path, too

gitdir: /Users/yourusername/obsidian.git

However it would be best if this plugin supports setting git & gitdir from the plugin's option, since isomorphic-git already supported those options https://isomorphic-git.org/docs/en/dir-vs-gitdir, or at least support adding environment variables apart from PATH so I can set GIT_DIR

@Vinzent03
Copy link
Collaborator

You should now be able to specify a GIT_DIR via a new added setting. Works for mobile as well.

@zfei
Copy link
Author

zfei commented Jan 17, 2023

Works like a charm. Thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants