obsidian-git
obsidian-git copied to clipboard
[Bug]: Git commands pass null in Obsidian, works fine via command line
Describe the bug
When using the commands in the Obsidian UI, nothing works. It's passing null to the command. The remote origin URL and the default branch of master are both set.
Git Pull using Obsidian Git:

Git Pull via terminal:
MINGW64 ~/Desktop/Vaults/Programming (master)
$ git pull origin master
From https://github.com/username/vault-repo
* branch master -> FETCH_HEAD
Already up to date.
Relevant errors (if available)
git obsidian error: null
fatal: ambiguous argument 'null': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
plugin:obsidian-git:10679 Uncaught (in promise) Error: null
fatal: ambiguous argument 'null': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
at Object.action (plugin:obsidian-git:10679:25)
at PluginStore.exec (plugin:obsidian-git:10704:25)
at eval (plugin:obsidian-git:8499:43)
at new Promise (<anonymous>)
at GitExecutorChain.handleTaskData (plugin:obsidian-git:8497:16)
at GitExecutorChain.eval (plugin:obsidian-git:8481:44)
at Generator.next (<anonymous>)
at fulfilled (plugin:obsidian-git:7333:24)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Steps to reproduce
- Create a repository on GitHub
- Create new vault
- Install Obsidian Git and enable
- Set remote origin to GitHub repo URL
- Try any command in Obsidian Git (like pulling the repo)
- Try any command in terminal shell
Expected Behavior
Obsidian Git should behave the same as running commands in terminal.
Addition context
Output of git branch info in terminal
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Operating system
Windows
Plugin version
1.26.1
Does the same happen for stage/commit? Or only for pull?
Found the same issue on mac.
Figured a workaround for getting the sync to work while the bug gets fixed:
- Create your repo and push the changes from terminal once
- Delete your local vault and clone the repo into a new folder
- Open the new clone folder as a vault on Obsidian desktop
This workaround did the trick for me on mac.
Tried other commands, Issue was happening because there wasn't an upstream set. git branch --set-upstream-to origin/master fixed it.
Wouldn't have known if if the Obsidian Git Push command error didn't tell me no upstream was set, since Obsidian Git Pull just gave the null error.