"Cannot run Git Command" pops up and Obsidian Git Plugin won't connect to branch

Heyhey, so I’m trying to sync my notes into Github so I can also access it on mobile too. (and back it up too lol)

I’m very new and not as interested in coding, so every tutorial just left me confused until I found this article/tutorial which is very simple but the plugin won’t connect to my ‘main’ branch?

If you look at the ‘current branch’ on the first pic it’s connected to main but mine is empty and nothing pops down on the menu.

There was also this youtube tutorial where you store Obsidian files directly in Github but I’m unsure if it would sync on mobile?

I am at a lost here, some help would be cool

I’ve already tried uninstalling and re-installing the plugin and re-doing the Github thing but still stays the same

You might need to include more detail about the steps you took during that tutorial.

  • Do you already have a git repository initialized in your Vault? (From step 2. Add an Existing Repository from your Hard Drive) - Of course I’m assuming you do, since you said you have a branch named main. But there aren’t any details to go off of yet in your post.
  • Did you already push it to Github? Can you see your files in Github yet? From step 3.
  • In step 2 there is a warning about how “Create a New Repository” will create a subfolder in your vault. But you want to make sure to “Add an Existing Repository” and choose your actual Vault. Did that successfully work? Where is your hidden .git folder located? Is it directly inside your vault?

(That’s all I can think of for now.)

Oh, I don’t have a git repository initialized in my vault. I don’t know how to.

Yeah I already pushed it to Github and I could see my files, but yeah probably it doesn’t work cause I have no git repo in vault (I guessed I overlooked that but I still don’t know how.)

That doesn’t quite make sense. You couldn’t push it to Github unless it already is a repository. You can only push files in a repository to Github. You know it is a repository if there is a hidden .git folder inside your vault.

If you’re using the Github app to do it, the instructions in step 2 says to “Add an Existing Repository from your Hard Drive”, and you just select your Vault folder. It should set it up for you.

What OS are you using? In Windows you can go to the view options in the toolbar and show hidden folders. And in MacOS you can just hit Cmd-Shift-. to show hidden files. And then you can locate where that .git folder ended up.

And then maybe show a screenshot or something? Either of your Github app, or your vault folder with hidden files shown, if there is no sensitive information.

image

I’m on Windows 10. Yeah I checked for a .git folder, and saw I placed it in my general folder for obsidian and not the vault itself. Moved it there and when I check github this is what I see

But this is my folder content

That should explain why the git plugin couldn’t see it.

One side note, if you move the .git folder manually, I am betting your Github app won’t be able to see it anymore. You’ll likely need to point to the new location in the settings. (That’s just for the Github app. The git repository will still continue to work. But from its perspective, if you had any committed files, it would think they were deleted or changed or moved. It “sees” your files relative to where it is located. BUT you don’t seem to have any committed files yet. So no worries. Sorry if that is info overload.)

After you move the folder, does the git plugin in Obsidian now see your repository branch? Did it fix the problem?

Cool, so the .git folder is now in my vault folder (didn’t move it manually) but the plugin still says “Cannot run git command” and still can’t see the branch

In these instructions, on Windows you may have to enable git to be run from 3rd-party software. Did you do that, when you installed everything?

(I don’t know where that setting is found. Perhaps in the Github client app? I’m not on Windows, nor do I use that client.)

I was looking for that! Yeah I was trying to set up git but I lost the tutorial so I gave up.

So am checking out this youtube tutorial and I’m on that part, just right after git clone (url)

The clone folder was cloned in the original folder and I want to move it to my main obsidian folder and replace the files but I’m afraid I might mess something up?

Essentially I set up my username, email, then cloned the http url

Just took the leap of faith and moved it to my main folder and it works! But when I added a new note it didn’t really sync to github. I might just try for google drive, sorry for taking your time, it was great help but I suppose I’m not well suited for these kinds of things. Have a nice day and thank you!

1 Like

Hi Bro, I don’t know if you still want to use GitHub but I have the same problem as you, you just have to install this Git - Downloading Package and restart obsidian, then you should be able to commit files

you have to install git-scm here’s the link

https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.