gitgithubsshhttpsobsidian

Obsidian => Authentication failed (publickey)


I don't know how many guides, tutorials and posts I have already read about this problem, but I can't find any suitable solution to fix this issue. I try to set up Obisidan and it's GitHub plugin on my Windows computer. I have created a private repository on GitHub and cloned this repository already successful to my PC. With the git bash and also with the powershell I am able to access the repository via SSH. So I can pull/push/merge etc.

As soon as I use Obsidian and enable the Obsidian Git plugin I always get the same error:

git obsidian error: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

and

plugin:obsidian-git:29119 Uncaught (in promise) Error: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at Object.action (plugin:obsidian-git:29119:25)
    at PluginStore.exec (plugin:obsidian-git:29144:25)
    at eval (plugin:obsidian-git:26649:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (plugin:obsidian-git:26647:16)
    at GitExecutorChain.eval (plugin:obsidian-git:26631:44)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-git:25476:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I understand the message. Something is going wrong with the authentication, but I do not understand why this happens, since I can access the repository with the tools mentioned above.

Looking for the solution I tried to use the Git CLI and it's caching. I also tried to use the HTTPS url. Nothing seems to work. Does someone have any advice?

Best regards, Danny.


Solution

  • Okay, it took me ages to fix some issues, since the developer seems not to know how to come along with solving them.

    I had also an issue, that basically nothing was printed on screen after pressing the push or commit button in Obsidian. The reason was, that the SSH-Command in the git global settings was set to OpenSSH. Something like this:

    git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
    

    This is incorrect and causes even more damage. After deleting that line I was at least able to see the error messages again.

    The other issue "Permission denied (publickey)" is also "quite simple" to solve, as you know the reason behind. I found the solution here. For Windows there is no SSH support. So you have to create a new token in GitHub and use HTTPS as prefered cloning method. After cloning with my new token in HTTPS everything seems to work perfectly.

    Actually this issues almost made me deleting this entire stuff. I hope this solutions may help someone who also gets as much frustrated as me.

    Issues solved!