Giter Club home page Giter Club logo

Comments (21)

mcanueste avatar mcanueste commented on May 26, 2024 34

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.

from obsidian-git.

ebouchut avatar ebouchut commented on May 26, 2024 10

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:

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/config and add the 2 lines AddKeysToAgent yes and UseKeychain yes to the Host github.com section, so that you are not asked for the passphrase each time obdisian-git pushes 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        # <===

from obsidian-git.

AmberCronin avatar AmberCronin commented on May 26, 2024 2

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: #23 (comment) and that fixed it.

from obsidian-git.

zkwinkle avatar zkwinkle commented on May 26, 2024 2

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        # <===

from obsidian-git.

jasenmichael avatar jasenmichael commented on May 26, 2024 2

chmod 600 ~/.ssh/config worked for me

from obsidian-git.

jvsteiner avatar jvsteiner commented on May 26, 2024 2

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.

from obsidian-git.

nikelborm avatar nikelborm commented on May 26, 2024 1

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:

  1. I tried to clone an obsidian repo from github.com
  2. Git asked me if I trust the remote server
  3. I said yes
  4. It added record to ~/.ssh/known_hosts
  5. 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:

  1. Open the terminal
  2. Go to your repo folder
  3. run git pull simply to invoke this "do you trust the remote server" dialog
  4. answer yes
  5. restart obsidian

Now the error will go away

from obsidian-git.

trydalch avatar trydalch commented on May 26, 2024

+1
Running on Windows 10, ssh key set up for github.com. Can push manually with git cli.

from obsidian-git.

tklosek0 avatar tklosek0 commented on May 26, 2024

+1
Running on linux, ssh key also set up and also correctly pushing via CLI.

from obsidian-git.

desktopofsamuel avatar desktopofsamuel commented on May 26, 2024

+1 but able to resolve after disable and reinstall the plugin again on Windows 10.

from obsidian-git.

6220119 avatar 6220119 commented on May 26, 2024

If anyone is encountering this issue, make sure you have the Disable Push setting toggled off (see the screenshot) and restart Obsidian

image

from obsidian-git.

notalexnot avatar notalexnot commented on May 26, 2024

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.

from obsidian-git.

zkwinkle avatar zkwinkle commented on May 26, 2024

Hello, I'm on linux and tried replicating the steps outlined by #39 (comment) 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?

from obsidian-git.

ebouchut avatar ebouchut commented on May 26, 2024

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.

from obsidian-git.

Vinzent03 avatar Vinzent03 commented on May 26, 2024

@zkwinkle Has the ssh key a passphrase and if so, do you have to enter it when you use it via command line?

from obsidian-git.

ar-to avatar ar-to commented on May 26, 2024

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.

from obsidian-git.

andresmgomezg avatar andresmgomezg commented on May 26, 2024

chmod 600 ~/.ssh/config

Did you solve the problem? I have the same problem and have not been able to solve it.

from obsidian-git.

ospknb avatar ospknb commented on May 26, 2024

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

from obsidian-git.

umamibeef avatar umamibeef commented on May 26, 2024

chmod 600 ~/.ssh/config worked 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.

from obsidian-git.

eltonleao avatar eltonleao commented on May 26, 2024

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.

thanks!

from obsidian-git.

kindofliz avatar kindofliz commented on May 26, 2024

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.

thanks from me too, fixed my issue!

from obsidian-git.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.