Open DanShui-Yu opened 9 months ago
@DanShui-Yu You probably set up the username, PAT, and URL properly. I'm assuming that your system does not know where the git binary is located.
I don't know how your computer is set up, but if you open a raw Command Prompt on Windows or Terminal on Mac and do git -v
, does it print your git version? If not then git is not added to your system PATH.
In any case, easiest way to resolve this is to find where your git binary (git.exe) is located and just set that directory in the plugin settings:
I made a PR https://github.com/kevinmkchin/Obsidian-GitHub-Sync/pull/3 to make the "Vault is not a Git repo or git binary" error message a bit more verbose, maybe that makes setting this plugin up a bit easier
I had a similar issue that was caused by the git binary needing to be specified, even though it's in the default location. Maybe something in this solution process will show the answer. #4
Hello Kevin. I have same issue. I have installed Obsidian on Ubuntu as Snap.
In the plugin settings I have set: Github username; token; repo url; git binary = /usr/bin/git. And I get: Vault is not a Git repo or git binary cannot be found. Problem: Error: fatal: not a git repository (or any of the parent directories): .git
If I don't set git binary field I get: Vault is not a Git repo or git binary cannot be found. Problem: Error: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty Received " Could this be because I use Snap and the Obsidian doesn't access to my file system?
@fitincontact
I can confirm that when installing Obsidian as Snap or Flatpak the plugin won't function as it's not able to find/access Git installed on the system. If you install the regular Deb the plugin should function fine.
You just have to put the git binary location although it optional,
by running which git
it will give you the git location. In my case git location is /opt/homebrew/bin/git
After that it will works fine. But some common thing need to check before sync,
Assume that you already created git repo in github then don't forget to add these lines into .gitignore
because it contain your github's personal access token which refuse by Github from exposing publicly.
.obsidian/plugins/github-sync/data.json // this is enough but you can also add the bellow or use pattern
.obsidian/plugins/github-sync/main.js
.obsidian/plugins/github-sync/manifest.json
.obsidian/plugins/github-sync/styles.css
basically that's it.
For macOS (solution)
You just have to put the git binary location although it optional, by running
which git
it will give you the git location. In my case git location is/opt/homebrew/bin/git
After that it will works fine. But some common thing need to check before sync, Assume that you already created git repo in github then don't forget to add these lines into
.gitignore
because it contain your github's personal access token which refuse by Github from exposing publicly..obsidian/plugins/github-sync/data.json // this is enough but you can also add the bellow or use pattern .obsidian/plugins/github-sync/main.js .obsidian/plugins/github-sync/manifest.json .obsidian/plugins/github-sync/styles.css
basically that's it.
still not working.
I found a solution, I have to init my git repo in ~/Documents/Obsidian Vault.
Finally, this extension works.
For macOS (solution)
You just have to put the git binary location although it optional, by running
which git
it will give you the git location. In my case git location is/opt/homebrew/bin/git
After that it will works fine. But some common thing need to check before sync, Assume that you already created git repo in github then don't forget to add these lines into
.gitignore
because it contain your github's personal access token which refuse by Github from exposing publicly..obsidian/plugins/github-sync/data.json // this is enough but you can also add the bellow or use pattern .obsidian/plugins/github-sync/main.js .obsidian/plugins/github-sync/manifest.json .obsidian/plugins/github-sync/styles.css
basically that's it.
This did it for me, thanks! Great plugin thanks Kevin.
i get this error. \ my repository is initialized in the vault, not outside of it. what could be the issue here? Also i am using ubuntu 24.04 and installed the obsidian via the deb package.
also PAT wasn't used once yet if that helps
windows git binary location should be end with “/”,like "G:/PortableGit/bin/"
windows git binary location should be end with “/”,like "G:/PortableGit/bin/"
I am using ubuntu
On macOS, it worked after removing the "git" at the end of the git binary path. It should end with a slash , ie: "/usr/bin/"
On macOS, it worked after removing the "git" at the end of the git binary path. It should end with a slash , ie: "/usr/bin/"
I am using Pop Os 22.04, just tried this and it works just right. Thanks for this :)
@deepesh15 I am using Ubuntu 22.04. I did put "/usr/bin/" in the field of git binary location and the remote URL to "github.com//Obsidian.git" but still get the error. Can you help me out? ( = replaced)
@Nik2890 , check if you have it installed (ik, you have it installed).
which git
git@github.com:<username>/<reponame>.git
try these if it doesn't we can discuss it more,
Thanks for your help @deepesh15 I did all of that but it did not help. Still same error. I use the https not the ssh. Could that be the problem?
I thinks Https / ssh should not matter, but you can try ssh maybe it'll work ?. wait have you setup the personal token too ? Try setting that up https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
@deepesh15 Thank you for your help it did not work but im using Win now. That seams to work fine.
Hello Kevin. I filled in the information according to the format, but I kept getting the following prompt and couldn't complete the synchronization.
I am sure that my personal access token has been opened with all permissions and the repo has been
init
. There is also a.git
folder in the root directory of my vault. What could be the problem?Or, perhaps, as a novice, my understanding of "GitHub username, personal access token, and the URL for your GitHub repo" is incorrect? Could you please provide a more specific example?