denolehov / obsidian-git

Backup your Obsidian.md vault with git
MIT License
6.14k stars 250 forks source link

[Bug]: Git is not ready #632

Closed Seunggu0305 closed 8 months ago

Seunggu0305 commented 8 months ago

Describe the bug

image

my local Windows 10 laptop's obsidian git says it is not ready with the above notice.

how can I fix this?

Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)

![image](https://github.com/denolehov/obsidian-git/assets/42400325/26cc2ba9-d640-4d5c-b3d7-0fdf32a62ce7)

git obsidian error: Error: TypeError: Cannot read properties of undefined (reading 'isBuffer')
plugin:obsidian-git:43448 Error: TypeError: Cannot read properties of undefined (reading 'isBuffer')
    at GitExecutorChain.onFatalException (plugin:obsidian-git:26622:79)
    at GitExecutorChain.eval (plugin:obsidian-git:26614:24)
    at Generator.throw (<anonymous>)
    at rejected (plugin:obsidian-git:25483:29)

Steps to reproduce

I have no idea with steps

Expected Behavior

No response

Addition context

No response

Operating system

Windows

Installation Method

None

Plugin version

2.22.0

Seunggu0305 commented 8 months ago

Reopening...

absane commented 8 months ago

Ah, I am not the only one that this happened to. I have been sketching my head for the last 2 hours. I would like to know if it's related to a recent update. This morning, I updated .NET as well as the VMWare Workstation. After that, I discovered that Obsidian Git was giving this same error. To diagnose, I opened WSL2 and found it was now broken, stating it could not locate the Hyper-V network bridge. I finally fixed all of that, and I can confirm that Git works as it always has. Within WSL2, I can use Git, and within CMD.exe, I can use Git.

The Obsidian Git plugin hasn't been updated in 2 months, so I suspect the .NET or the VMWare Workstation update broke it. That is just my theory...

I will keep poking around because this problem is affecting my work. I will update if I figure out how to resolve it.

absane commented 8 months ago

@Seunggu0305 I found the cause on my end. The obsidian-local-images-plus plugin pushed an update that somehow broke Obsidian Git's usage of the Buffer module (actually, it is simple-git). I don't know how or why. I noticed that if I moved my Obsidian vault to another drive (from my secondary drive D to my desktop on C), I could open my vault and Obsidian Git worked. if I moved it back to D, it broke.

As it turned out, Local Images Plus was to blame. I reverted back to Local Images Plus 0.15.8 and that fixed the issue.

From what I can tell, the Local Images Plus plugin in 0.15.8 overrides the global Buffer.isBuffer method, which affects simple-git within Obsidian Git.

https://github.com/Sergei-Korneev/obsidian-local-images-plus/commit/4b4ae126b3107bb9e0235401075fe183f12f7602#diff-39b2554fd18da165b59a6351b1aafff3714e2a80c1435f2de9706355b4d32351

Seunggu0305 commented 8 months ago

@absane Thanks for your fast check and reply. How did you revert back the Local Image Plus to 0.15.8?

absane commented 8 months ago

@absane Thanks for your fast check and reply. How did you revert back the Local Image Plus to 0.15.8?

So you had that installed as well and currently at 0.15.9?

I had a backup of my previous plug-ins, so it was as simple as drag and drop. But their release section on their GitHub repo has it as well.

I opened an issue there as well, letting them know of the breaking change.

Sergei-Korneev commented 8 months ago

@absane @Seunggu0305 I have just made some temporary fix and updated latest release. Just reinstall the plugin.

Seunggu0305 commented 8 months ago

@absane @Sergei-Korneev Thanks for your help!

electblake commented 8 months ago

To be clear, steps I took to resolve:

  1. disable and uninstall obsidian-local-images-plus plugin
  2. reload obsidian "Reload app without saving" (or close/open Obsidian I suppose)
  3. success! Now see status bar shows active branch and git status
  4. re-install and enable obsidian-local-images-plus plugin
  5. still success, confirmed by final reload/re-open of obsidian with local-images-plus installed+enabled

Thanks to OP and co for research, updates, and speed resolution