kevinmkchin / Obsidian-GitHub-Sync

Sync Obsidian vault to personal GitHub
MIT License
110 stars 12 forks source link

"Vault is not a Git repo or git binary cannot be found." #2

Open DanShui-Yu opened 9 months ago

DanShui-Yu commented 9 months ago

Hello Kevin. I filled in the information according to the format, but I kept getting the following prompt and couldn't complete the synchronization.

image

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?

kevinmkchin commented 8 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:

image
alskgj commented 8 months ago

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

PolyTyme commented 8 months ago

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

fitincontact commented 6 months ago

Hello Kevin. I have same issue. I have installed Obsidian on Ubuntu as Snap.

  1. 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

  2. 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?

roelwillems commented 5 months ago

@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.

sefatanam commented 5 months ago

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

Screenshot 2024-06-14 at 10 29 21 PM

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.

lumixraku commented 5 months ago

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 Screenshot 2024-06-14 at 10 29 21 PM

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.

lumixraku commented 5 months ago

I found a solution, I have to init my git repo in ~/Documents/Obsidian Vault.
Finally, this extension works.

alexfayad commented 4 months ago

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 Screenshot 2024-06-14 at 10 29 21 PM

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.

mpshmakov commented 4 months ago

i get this error. image \ 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.

mpshmakov commented 4 months ago

also PAT wasn't used once yet if that helps

huahua-er commented 3 months ago

windows git binary location should be end with “/”,like "G:/PortableGit/bin/"

mpshmakov commented 3 months ago

windows git binary location should be end with “/”,like "G:/PortableGit/bin/"

I am using ubuntu

asaeed commented 3 months ago

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/"

deepesh15 commented 2 months ago

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 :)

Nik2890 commented 3 weeks ago

@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)

deepesh15 commented 3 weeks ago

@Nik2890 , check if you have it installed (ik, you have it installed).

try these if it doesn't we can discuss it more,

Nik2890 commented 3 weeks ago

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? obsidian

deepesh15 commented 2 weeks ago

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

Nik2890 commented 2 weeks ago

@deepesh15 Thank you for your help it did not work but im using Win now. That seams to work fine.