Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication issue with ssh passphrase #42

Open
evanaze opened this issue Jan 23, 2021 · 17 comments
Open

Authentication issue with ssh passphrase #42

evanaze opened this issue Jan 23, 2021 · 17 comments

Comments

@evanaze
Copy link

evanaze commented Jan 23, 2021

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.

@icaroo
Copy link

icaroo commented Mar 4, 2021

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

@s-kyy
Copy link

s-kyy commented Mar 8, 2021

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?

@Vinzent03
Copy link
Owner

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

@Vinzent03 Vinzent03 changed the title Pull failed Authentication issue with ssh Mar 16, 2021
@s-kyy
Copy link

s-kyy commented Mar 16, 2021

@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.

@Vinzent03
Copy link
Owner

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

@Vinzent03
Copy link
Owner

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.

@s-kyy
Copy link

s-kyy commented Mar 16, 2021

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

@Vinzent03
Copy link
Owner

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

@Vinzent03 Vinzent03 changed the title Authentication issue with ssh Authentication issue with ssh passphrase Mar 16, 2021
@MikeTuomas
Copy link

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

@ZerkerEOD
Copy link

@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?

@s-kyy
Copy link

s-kyy commented Jun 8, 2022

@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.

@jakobbohem
Copy link

jakobbohem commented Jul 6, 2022

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! :)

@bramuccci
Copy link

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

@cybersholt
Copy link

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

@veggie-garden
Copy link

veggie-garden commented Feb 26, 2023

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

@Kabobi
Copy link

Kabobi commented Apr 1, 2023

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

@NurgisaA
Copy link

NurgisaA commented Dec 22, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests