denolehov / obsidian-git

Backup your Obsidian.md vault with git
MIT License
6.15k stars 252 forks source link

Incorrect Path -> Failed Git Error Documentation #583

Closed aicayzer closed 9 months ago

aicayzer commented 10 months ago

Reproduction Steps:

  1. Create a vault
  2. Change the name of a parent folder to that vault (e.g. /Documents/Vault -> /NewDocuments/Vault)
  3. Obsidian Git will say "Can't find a valid git repository. Please create one via the given command or clone an existing repo.”

Thankfully I was able to diagnose the issue pretty quickly but on another day, or for those less technically inclined, I can see this being a bigger issue.

Suggested Outcome: Add a “Warning” to the Documentation or Readme.

Vinzent03 commented 10 months ago

Did you move your vault or did you have to add that folder as a new vaul? And what have to done to fix that. Please use the bug template next time!

aicayzer commented 10 months ago

Hey,My apologies! Will do as a bug next time. I created the vault & then, outside of Obsidian, renamed the parent folder which is was in. e.g. /Documents/Folder/Vault -> /Documents/SameFolderDifferentName/VaultTo fix it, I removed the Vault from Obsidian & then re-added it. i.e. clearly somewhere Obsidian Git gets the route for the Vault from Obsidian. Although Obsidian continues to work if you rename the parent folder (or any other folder between the vault and the root directory of your device), the update doesn’t perpetuate to Obsidian Git (maybe an Obsidian issue). Let me know if you want any further details :) Sent from my iPhoneOn 23 Aug 2023, at 7:10 pm, Vinzent @.***> wrote: Did you move your vault or did you have to add that folder as a new vaul? And what have to done to fix that. Please use the bug template next time!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

Vinzent03 commented 10 months ago

Okay so you renamed a parent folder of the vault and therefore had to re-add the vault to Obsidian. Everything should still work in the plugin except settings that are not stored in the vault are lost, but those shouldn't affect this error message. Does the plugin work now and if so have you changed something to fix it? What exactly do you want to be documented?

aicayzer commented 10 months ago

Prior to realising the issue, I was very confused why Obsidian Git didn't work. I think it would be good if the scenario I ran into was documented because I can for-see others having this issue in the future. Let me recap just so we're clear:

My Obsidian Vault (despite having renamed the parent folder) worked as normal. i.e. i didn't have to remove & re-add it, it continued to work irrelevant of the renamed parent folder. So too did all my other plugins.

A month later, I installed the Obsidian Git plug-in. Despite having a working Git repository in the Vault Directory, it kept showing the error message.

Given Obsidian was working as normal &, 6 months ago I'd been using the Plugin with this Vault (uninstalled in-between), I was very confused why the Plug-in kept saying there wasn't a Git repository configured.

So what do I want documented/fixed?

Either an updated to the plug-in which, if Obsidian Git's stored value for the route directory =! the actual route directory, shows an error and says "remove & re-add vault".

Or an update to the documentation troubleshooting saying "If you're having issues & you've renamed the parent file, try removing the Vault and re-adding it to Obsidian".

Or a fix the code which leads to this issue. I haven't had time to properly inspect the code but I'll try do so and, if i spot it, will open a PR (if I have the required permissions).

It's certainly an unusual issue so I understand if it doesn't make the documentation!

Hopefully that helps & clarifies the issue.

Thank you

Vinzent03 commented 10 months ago

Did you have your Obsidian vault open while renaming the parent directory? Please don't do that. Obsidian has to be closed and the new vault to be opened. Alternatively, you can move your vault from the vault switcher. There is no issue with this plugin, just the fact that you moved your .git folder, because your renamed a parent folder. When you create a new folder in the still opened vault via Obsidian, it still operates in that old folder.

aicayzer commented 9 months ago

Sorry missed the above. I don't believe I did but I can't remember for sure.

In the eventuality someone does have a similar issue to me I feel like this thread documents the solution well enough so will close this here.