obsidian-git icon indicating copy to clipboard operation
obsidian-git copied to clipboard

Authentication issue with ssh passphrase

Open evanaze opened this issue 4 years ago • 17 comments

Hi,

I am getting the error message: Screen Shot 2021-01-23 at 9 43 00 AM

About my setup:

I have obsidian-git running on both my Mac and an Arch Linux install. It works great on Arch Linux, but I get the above error message on Mac whenever I start Obsidian. I use SSH to pull from Git, and I have two different SSH keys on my two machines. The key on my Arch Linux machine is not password protected, and my Mac's is. They are both added to ssh-agent and I have no problems pulling or pushing to git outside of this on either machine.

Happy to provide any more info. I checked the Issues and could not find any similar to mine. Thank you.

evanaze avatar Jan 23 '21 17:01 evanaze

Same here, but Windows user. I'm using gitbash, works ok by command line.

icaroo avatar Mar 04 '21 13:03 icaroo

Same issue on my end with Windows, I only have one ssh key linked to github, so maybe it needs to save the ssh password?

s-kyy avatar Mar 08 '21 04:03 s-kyy

When you use your ssh key, you have to type in your ssh-key password right?

Vinzent03 avatar Mar 16 '21 14:03 Vinzent03

@Vinzent03 Whenever I open git bash, I:

  1. start the ssh-agent
  2. ssh-add the relevant keys + you get prompted for a password to type in here
  3. Do the usual git pull/add . / commit / push steps

I think if you don't add the ssh keys, then you get prompted for the password each time. Personally, I adjusted my ~/.bashrc file so that every time I open a git bash terminal I add my ssh keys + pw's at the beginning.

s-kyy avatar Mar 16 '21 15:03 s-kyy

The problem is the passphrase . Will take a look how to solve this.

Vinzent03 avatar Mar 16 '21 15:03 Vinzent03

When you use the default terminal and start the ssh-agent and run ssh-add. And type in your passphrase. Does the issue still persist? I can't help more, because I am on Linux.

Vinzent03 avatar Mar 16 '21 19:03 Vinzent03

Using the git bash terminal, entering ssh-add and leaving it open while I run a git pull from Obsidian, I get the same error: image

I haven't set it up using the Windows command terminal before, but maybe this link would help? https://stackoverflow.com/a/40720527

s-kyy avatar Mar 16 '21 19:03 s-kyy

Well you have to tell me if this works. That has nothing to do with this plugin.

Vinzent03 avatar Mar 16 '21 21:03 Vinzent03

Running ssh-add resolved this for me. I am using macOS 11.3.1

MikeTuomas avatar May 17 '21 10:05 MikeTuomas

@s-kyy, sorry I know this is closed but wondering what you did to prevent being asked every time rather than the first time when opening the terminal. Is there a way to check if the key has already been added?

ZerkerEOD avatar Jun 08 '22 16:06 ZerkerEOD

@ZerkerEOD Assuming you use Windows, and that you already setup your ssh keys I have two files in my ~/ user folder:

~/.bash_profile

# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc

~/.bashrc (or ~/.profile):

eval `ssh-agent`
ssh-add 

Then in the ~/.ssh/config file:

Host github.com #custom name for the host
  HostName ssh.github.com #or other website directing to the host
  User git #usually your username, but github ssh takes git as the username
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa #add your ssh-key file path

AddKeysToAgent yes

It's been a while since I modified this setup, but I think this is all you need. This would prompt a password (if there is one) for your ssh keys that you're adding every time you open git bash (linked to Git for Windows).

Hope it works for you.

s-kyy avatar Jun 08 '22 17:06 s-kyy

was able to work around this by enabling Windows 11:s OpenSSH executable in git (re-running the installer, making sure to select Windows OpenSSH as the preferred version) and running the ssh-agent as a Windows service according to the guide here https://interworks.com/blog/2021/09/15/setting-up-ssh-agent-in-windows-for-passwordless-git-authentication/

Good luck everyone struggling and let me know if this works for anyone! :)

jakobbohem avatar Jul 06 '22 09:07 jakobbohem

I ended up removing the passphrase. I know is not a good solution, but is a simple one. ssh-keygent -p

bramuccci avatar Dec 22 '22 15:12 bramuccci

Depending on your setup with Windows 10 you may need to add this via an elevated console, only if you're using OpenSSH for Windows

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

cybersholt avatar Jan 04 '23 18:01 cybersholt

ssh-add also works in windows 11! I followed what exactly written over here. Thanks for all the information everyone.

veggie-garden avatar Feb 26 '23 15:02 veggie-garden

I solved this problem by setting the default SSH user, in the ~/.ssh/config file:

 Host *
    User your_default_ssh_user
    IdentityFile ~/.ssh/your_default_ssh_key

Kabobi avatar Apr 01 '23 16:04 Kabobi

i am using manjaro and ssh-askpass not defined, but system used ksshaskpass. Im trying use alias, but this dont work. How to fix it.

upd: im fixed by setup to "Additional environment variables" SSH_ASKPASS=/usr/bin/ksshaskpass // or you path

NurgisaA avatar Dec 22 '23 16:12 NurgisaA