obsidian-git
obsidian-git copied to clipboard
Not able to push
Hey, love the plug-in. But I'm not able to get it to push commits It shows the login, but it keeps giving me an error about not being able to reach the host or find the repo... Which definitely exists, and it's the right login as well I'm able to make a work around of manually pushing it through GitKraken if I need to, but would love to not have to go through the extra steps if at all possible
+1 Running on Windows 10, ssh key set up for github.com. Can push manually with git cli.
+1 Running on linux, ssh key also set up and also correctly pushing via CLI.
+1 but able to resolve after disable and reinstall the plugin again on Windows 10.
If anyone is encountering this issue, make sure you have the Disable Push setting toggled off (see the screenshot) and restart Obsidian

When I'm not using Obsidian (writing, editing, etc.) it works fine, but when I use it is when the error appears. I think that it is somewhat similar to the error that appears in the file explorer when you try to move or rename a file while it's still open.
Issue
⚠️ On MacOS (at least Mojave 10.14.6), the following error occurs when obsidian-git attempts to push commits to the remote repository.
git-error.js:33 Uncaught (in promise) Error: Pushing to [email protected]:ebouchut/obsidian-eric.git
ssh_askpass: exec(/usr/X11R6/bin/ssh-askpass): No such file or directory
no such identity: /Users/eric/.ssh/ids/github.com/id_rsa: No such file or directory
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Cause
Here is my understanding of the problem.
As Obsidian is not launched from the shell but as a UI program, whose parent is launchd it does not benefit from the environment variables appropriately set by the shell hence it does not find the keys in your ssh-agent.
In fact, it searches for keys in launchd's keystore.
Workaround
✅ The workaround is to install a program named ssh-askpass thatobsidian-git uses to popup a small window asking you to enter your keystore's passphrase and adds the key in launchd's keystore.
Here is how I solved this issue:
- Install
ssh-askpass
brew tap theseal/ssh-askpass
brew install ssh-askpass
sudo ln -s /usr/local/bin/ssh-askpass /usr/X11R6/bin/ssh-askpass
- Log out then log back in.
- Edit
~/.ssh/configand add the 2 linesAddKeysToAgent yesandUseKeychain yesto theHost github.comsection, so that you are not asked for the passphrase each timeobdisian-gitpushes to the remote.
Host github.com
User git
Hostname github.com
#
# use only the publickey authentication method
# Default is publickey,password,keyboard-interactive,hostbased
# PreferredAuthentications publickey
#
IdentityFile ~/.ssh/id_rsa
# Use only the key specified in IdentityFile,
# ignoring the keys already loaded in ssh-agent
IdentitiesOnly yes
AddKeysToAgent yes # <===
UseKeychain yes # <===
Hi,
I was having the same problem even though I followed @ebouchut's workaround. Turns out my problem was the permissions on the ~/.ssh/config file. After doing chmod 600 ~/.ssh/config it worked properly without an issue. Hope this helps in case anyone is still having the problem after the workaround.
~~Hi, I'm encountering this issue as well for just the past few days.~~ ~~Latest versions of Obsidian Git, Obsidian, System, ect.~~ ~~Running Obsidian via the flathub flatpak build, on Fedora 33.~~ ~~Obsidian Git used to pop up a box asking for me to enter my ssh key password, and now just fails to push.~~ ~~Confirmed push works via command line and server is reachable.~~
Update: I ran the commands listed here: https://github.com/denolehov/obsidian-git/issues/23#issuecomment-806401774 and that fixed it.
Hello, I'm on linux and tried replicating the steps outlined by https://github.com/denolehov/obsidian-git/issues/39#issuecomment-798955390 but the UseKeychain yes property seems to be a MacOS thing, and I can't get it working. I'm on Linux and installed obsidian from the AUR (https://aur.archlinux.org/packages/obsidian/). At the moment I'm prompted for my passphrase whenever obsidian-git tries to backup, this is pretty annoying so I'm turning off the "backup every X mins" option for the time being, tho i'd love to use it. I have my keychain properly setup and everything so, any help on getting obsidian to access it?
Hi @ zkwinkle
Try adding this to ~/.ssh/config:
IgnoreUnknown UseKeychain
This will prevent errors about UseKeychain not being recognized on Linux.
If it keeps bothering you to enter the password each and every time you push we will dig on the cache side.
Yup, still bothers me to enter password each and every time, and also I have to input it twice for some reason? I'm very lost, this is my ~/.ssh/config file just in case:
Host gitlab.com
Hostname gitlab.com
#
# use only the publickey authentication method
# Default is publickey,password,keyboard-interactive,hostbased
# PreferredAuthentications publickey
#
IdentityFile ~/.ssh/id_ed25519
# Use only the key specified in IdentityFile,
# ignoring the keys already loaded in ssh-agent
IdentitiesOnly yes
AddKeysToAgent yes # <===
IgnoreUnknown UseKeychain
UseKeychain yes # <===
@zkwinkle Has the ssh key a passphrase and if so, do you have to enter it when you use it via command line?
chmod 600 ~/.ssh/config worked for me
I tend to forget the steps for setting up and configuring ssh until I start working with it again. In my case, I just needed to open the .git/config inside the root directory and after installing this plugin and setting up my github client. I already had ssh configured with ssh-agent and globally to use my ssh key with github so better refer to another doc for this. But once you open that file change the url from https to ssh. You can grab it from your github repo under the code dropdown.
example but substitute your info so best to copy from github.
~/.ssh/config but remember to reference another document on doing this like one.
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
then at /Users/aricode0/Documents/Obsidian Vaults/Testing-Github/.git/config from
[remote "origin"]
url = https://github.com/ar-to/Testing-Github.git
fetch = +refs/heads/*:refs/remotes/origin/*
to
[remote "origin"]
url = [email protected]:ar-to/Testing-Github.git
fetch = +refs/heads/*:refs/remotes/origin/*
now no worries and all works.
chmod 600 ~/.ssh/config
Did you solve the problem? I have the same problem and have not been able to solve it.
Setting the branch using the command palette under Obsidian Git: Switch branch worked for me. Somehow it got unset, IDK when and stopped working. Setting it again fixed it.
For the ~/.ssh/config file, the GitHub Docs state you should add:
Host *.github.com AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_ed25519 (changing the SSH key file to match your setup)
I found that this was actually the problem after looking at @ar-to comment.
Changing the Host to * or github.com fixed the problem. So it should read
Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_ed25519
OR
Host github.com (or whatever repository you are using) AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_ed25519
chmod 600 ~/.ssh/configworked for me
This also did the trick for me in Linux. I was getting the following error before:
node:internal/process/task_queues:96 Uncaught (in promise) Error: Bad owner or permissions on /home/<user>/.ssh/config fatal: Could not read from remote repository.
Setting the branch using the command palette under
Obsidian Git: Switch branchworked for me. Somehow it got unset, IDK when and stopped working. Setting it again fixed it.
thanks!
Setting the branch using the command palette under
Obsidian Git: Switch branchworked for me. Somehow it got unset, IDK when and stopped working. Setting it again fixed it.
thanks from me too, fixed my issue!
For future generations about what was the reason of the issue and how I fixed it. I have arch with latest obsidian from AUR.
Steps that led me to this error:
- I tried to clone an obsidian repo from github.com
- Git asked me if I trust the remote server
- I said yes
- It added record to ~/.ssh/known_hosts
- I successfully used obsidian with this plugin to work with this repo folder locally
At some moment I deleted ~/.ssh/known_hosts and then tried to use obsidian with obsidian-git plugin enabled. It didn't work because during automatic pull at the start git was showing that confirmation dialog again and the plugin wasn't able to handle it correctly.
Step to fix the error:
- Open the terminal
- Go to your repo folder
- run
git pullsimply to invoke this "do you trust the remote server" dialog - answer yes
- restart obsidian
Now the error will go away