17

I have this problem, I've created a Github repository to back up a project. I have normal SSH access to my repo from my Linux command line and I can push, pull, commit, sync and all that stuff with no problem. But when I try to use the VS Code github integration tool to push my changes it gives me this error:

Git: ssh_askpass: exec(usr/lib/ssh/ssh_askpass): No such file or directory.

I've looked for this file on the mentioned directory but all I've seen was a file named gassh_askpass.

I'm currently using Manjaro and VS Code 1.28.2

Gabe
  • 305
  • 1
  • 2
  • 10
  • 1
    What was missing in my answer? – VonC Feb 28 '22 at 20:08
  • 1
    Your answer helped me at that moment so I'm grateful and I appreciate it, but the question states the problem was found on Linux Manjaro. I thought it would be more useful for the incoming users if I selected an answer that matched the question specifications. – Gabe Feb 28 '22 at 20:37
  • Good point. I have edited my answer accordingly. – VonC Feb 28 '22 at 22:31

5 Answers5

9

I had to do 2 things to get this solved.

  1. Install ssh_askpass

     sudo apt install ssh-askpass
    
  2. Use this command to add bitbucket.org (In my case it was Bitbucket)

     ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts
    
Anton Perera
  • 353
  • 3
  • 9
7

If depends also on your OS.

For instance, Microsoft/vscode/issue 32097 illustrates various MacOS workarounds::

In my case, it's caused by updating of mac OS, makes git lose passphrase of my ssh key.
After ssh-add ~/.ssh/id_rsa, and REINSTALL vscode, this problem is fixed.

Or:

$ brew tap theseal/ssh-askpass
$ brew install ssh-askpass
$ sudo ln -s /usr/local/bin/ssh-askpass /usr/X11R6/bin/ssh-askpass

Or:

  • Download xQuartz latest version : https://www.xquartz.org
  • update and upgrade home-brew via 'brew update && brew upgrade'
  • link: $ sudo ln -s /usr/local/bin/ssh-askpass /usr/X11R6/bin/ssh-askpass as @stargriv described above :-)
  • Start VSCode, should work now
  • You still have to type in your password every time when you connect to the server; if you don't want that, create a ssh-key file.

For manjaro specifically, as mentioned in this thread:

If you are using Virt-Manager to connect to a remote hypervisor over SSH, you need to install openssh-askpass as well as x11-ssh-askpass

sudo pacman -S openssh-askpass x11-ssh-askpass

The OP Prabesh Bhattarai references "'ssh_askpass exec(/usr/libexec/openssh/ssh-askpass) no such file or directory' error when I try to push in Git repo using VS Code"

If you use services like SSH keys, make sure you don't disable SSH Key Agent. It was a stupid mistake

If the SSH-agent is disabled, it cannot register the passphrase indeed.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 5
    The op is using Manjaro, why is this answer for MacOS, and even more strange why is this answer accepted!!! – Jeton Thaçi Nov 07 '19 at 14:46
  • @JetonThaçi Good point. I must have mixed up (at 6AM when I wrote this) Mac OS Mojave (https://en.wikipedia.org/wiki/MacOS_Mojave) and Linux Manjaro (https://en.wikipedia.org/wiki/Manjaro)! But, as the OP said... "it worked like a charm". So here we are. – VonC Nov 07 '19 at 14:55
  • @VonC On Ubuntu 19.10, I install "ssh-askpass" using apt command. I did solve a part of problem. But its a annoying solution. Because it didn't just asked my ssh password 1 times, it asked me 1000 times, which is not why user ssh keys for. It should have asked only once. – Pranav Dec 15 '19 at 03:00
  • @Prabeshbhattarai It should not ask for any password. It might ask for a *passphrase*; only if your private SSH key was created with a passphrase. In which case, run an ssh agent, and add said passphrase to it: https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent. That way, VSCode won't ask it every time your are pushing to/pulling from a repository. – VonC Dec 15 '19 at 16:26
  • @VonC The link u mentioned, I have used it like a month ago to create SSH keys and integrate VSCode with my Github repo. It worked. A week ago I begin to notice the error message as mentioned in the blockquote in the above question. Are you telling me to recreate SSH keys and repeat everything that I've done in the past? – Pranav Dec 16 '19 at 08:01
  • @Prabeshbhattarai No, I am referring to the section "Adding your SSH key to the ssh-agent" of that page (https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent): re-add your *existing* private key to the SSH agent (only if your private key is passphrase-protected) – VonC Dec 16 '19 at 08:03
  • @VonC but the thing is you can't re-add the same key, it will throw the error message "The key is already in use" in Github. I have also followed the instruction mentioned in the link u mentioned. – Pranav Dec 16 '19 at 08:09
  • @Prabeshbhattarai Adding a key to your SSH agent is purely a local operation which does not involve GitHub: the section I mention does not involve github.com. – VonC Dec 16 '19 at 08:16
  • @VonC I think I solved my problem. It was a stupid mistake. Anway, thanks for your replies too. There is the link where I have asked and solved my own problem. https://askubuntu.com/questions/1196164/ssh-askpass-exec-usr-libexec-openssh-ssh-askpass-no-such-file-or-directory-e/1196494#1196494 – Pranav Dec 16 '19 at 08:36
  • @Prabeshbhattarai Great! I have included your comment in the answer for more visibility. – VonC Dec 16 '19 at 09:01
  • 2
    @VonC not bad. +1 from me. – Pranav Dec 16 '19 at 12:48
3

I had this problem after upgrading to MacOS Big Sur. Some of the options from VonC's answer worked for me, but in a slightly different combination. These were my steps to finally get VS Code working together with GitHub again:

1. (Re-)install ssh-askpass & start ssh-pass service

As the docs state::

brew install theseal/ssh-askpass/ssh-askpass

Or if you already had it installed (like me), then re-install:

brew reinstall theseal/ssh-askpass/ssh-askpass

Finally start the ssh-askpass service to load the SSH_ASKPASS environment variable via:

brew services start ssh-askpass

2. Prepare to create symbolic link to ssh-askpass (aka install xQuartz)

I simply wanted to create a symbolic link from /usr/local/bin/ssh-askpass to /usr/X11R6/bin/ssh-askpass. But I realized that in MacOS Big Sur the file /usr/X11R6 itself is a link to /private/var/select/X11 and that inside /private/var/select the X11 is simply gone. Trying to access it I got a cd: no such file or directory: /private/var/select/X11.

This can be fixed by installing the latest version of XQuartz from https://www.xquartz.org. Download the XQuartz-2.x.x.dmg, open it and follow the installation steps. Afterwards the folder /private/var/select/X11 is present again :)

3. Create symbolic link to ssh-askpass

Now we'll be able to create the symbolic link:

sudo ln -s /usr/local/bin/ssh-askpass /usr/X11R6/bin/ssh-askpass

4. Allow VS Code to access Systems Events in MacOS System Preferences

Using the GitHub integration in VSCode will only work, as we allow it to access System Events.app which itself is needed to interact with ssh-askpass. This can be configured in the MacOS System Preferences / Security & Privacy windows inside the Privacy tab. You may need to scroll down to the Automation point and check the box for Code (sorry I have only a German MacOS here):

vscode-privacy-automation-system-events-setting

5. Re-Start or even Re-Install VSCode

For me only re-starting VS Code didn't fix the problem. After having done all the steps mentioned above another error with ssh-askpass made it into my VS Code log: /usr/local/bin/ssh-askpass:2141:2142: execution error: „System Events“ error connection invalid (-2700)

As I also used homebrew to install VSCode I simply ran

brew reinstall visual-studio-code

to re-install it. Finally the GitHub integration worked again for me.

6. (Optional, only if your ssh key has a passphrase) Add your ssh key's passphrase to the MacOS keychain

If you created a ssh key which is secured by a passphrase, VS Code might ask you for that passphrase every time you use the Git integration (which was the case for me). If you don't want to type the passphrase every time, there was also a hint by VonC in the comments of his answer: you need to add the key's passphrase to the MacOS keychain (which is described in the GitHub docs).

Here is a brief summary what you need to do:

6.1 Enhance your ~/.ssh/config

Add the 3 lines to your ~/.ssh/config using your ssh key's name:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/your_key_file_name_here

6.2 Add your passphrase to the MacOS keychain

Run the ssh-add command using the -K parameter:

ssh-add -K ~/.ssh/your_key_file_name_here

Now your VS Code should stop asking for your key's passphrase!

jonashackt
  • 12,022
  • 5
  • 67
  • 124
2

For Manjaro users, you can install openssh-askpass:

pacman -S openssh-askpass

This will open a plasma-like passphrase dialog for SSH in VS Code when you try to pull and push to GitHub. This works for Manjaro.

nms
  • 60
  • 8
2

If your on Arch KDE and using ksshaskpass you can symlink to the location VSCode is asking for it.

sudo ln -s /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass

pensivepie
  • 106
  • 1
  • 6