denolehov / obsidian-git

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

[Bug]: Commits made but fatal errors prevent push #576

Closed marixel closed 11 months ago

marixel commented 11 months ago

Describe the bug

I've had this happen to me twice in separate vaults, although the errors were different. In this report I'll only be focusing on the more recent error. (Since it's happened twice, it may just be user error, but I'm going to file this report just in case.)

After setting up the plugin with few to no issues, it runs smoothly for a few hours at least to a few weeks at most. At some point, though, I begin to get fatal errors when the plugin tries to automatically push the commits (which it makes with success.) When trying to push directly from the command palette, I'm met with another fatal error (fatal: bad object; error: repo.git did not send all necessary objects.) This was also the error I got every time the plugin attempted to push its commits in my first vault.

When trying to assign an upstream branch in Git Bash with "git push -u origin main", I'm met with another error (as can be seen in the "Relevant errors" field.) I can't fetch my origin or pull from the remote repo (fatal error: bad object), and the problems remain when creating and/or switching branches.

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

Primary Error in Obsidian console:
Uncaught (in promise) Error: fatal: bad revision 'origin/main'

    at Object.action (plugin:obsidian-git:29110:25)
    at PluginStore.exec (plugin:obsidian-git:29135:25)
    at eval (plugin:obsidian-git:26640:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (plugin:obsidian-git:26638:16)
    at GitExecutorChain.eval (plugin:obsidian-git:26622:44)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-git:25467:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

"git push -u origin main" Error:
 ! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'repo.git'

Steps to reproduce

  1. Not exactly sure, but appears to be related to the creation of links through the "Unlinked mentions" panel a. I believe this may be the case because my first set of errors came while I was making links to a single document in rapid succession (probably around 3-4/s) and my second came after I made a single linkage between two existing notes.
  2. May otherwise be caused by commits/pushes done too frequently (I had mine set to every minute)

Expected Behavior

No response

Addition context

No response

Operating system

Windows

Installation Method

None

Plugin version

2.20.7