Forum Discussion

AlmoEnd's avatar
AlmoEnd
Dedicated Contributor
2 years ago

1password git support for ssh in WSL2?

I am only able to sync with Github using PATs; for some reason the SSH key is not retrieved, using VSCode with WSL extension, or from a command (zsh) shell I get access denied (publickey) when issuing git pull or git push commands. In a windows powershell or VSCode instance, behavior is "normal" and I'm prompted for access to the SSH key(s).


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided

5 Replies

  • clcavanaugh's avatar
    clcavanaugh
    New Contributor

    Sorry for the little bit of necromancy replying here, it just happened to be near the top of the results when i googled this issue.

    I was able to get this working in a similar manner to the way you work with the ssh-agent in WSL (I'm using the Ubuntu LTS version). Basically running 

    git.exe clone git@gitlab.com:project/project.git

     it was able to interact with the ssh-agent.exe setup.

    Probably a bit more to it technically but it works. Went ahead and aliased `ssh`->`ssh.exe` and `git` -> `git.exe` and everything works as I'd expect atm.

    • 1P_Phil's avatar
      1P_Phil
      Icon for Moderator rankModerator

      Hi clcavanaugh​ ,

      No problems from our side for sure!

      Hey, we are glad you were able to get it to work. Drop a note any time!

      Thanks,
      Phil

  • AlmoEnd's avatar
    AlmoEnd
    Dedicated Contributor

    Above isn't a workable workaround :) After a reboot ssh-add ~/.ssh/1p_github
    Could not open a connection to your authentication agent.
    looks like I'll have to run eval \ssh-agent -s` and enter the password each time. Can I import the toml file into WSL to make 1P take charge of SSH connections in the VM?

  • AlmoEnd's avatar
    AlmoEnd
    Dedicated Contributor

    I "solved" the issue by creating a new ed25519 key with ssh-keygen in WSL/Ubuntu. I then overwrote the contents of .pub and with my saved 1P github SSH items' public and encrypted private key. Then I ran ssh-add and was prompted for the passphrase I used for encryption of the private key. Subsequent pulls and pushes (and VSCode with WSL extension) worked without prompt, but it felt like a bit of a hack. Guess WSL isn't on the dev team's radar.

  • AlmoEnd's avatar
    AlmoEnd
    Dedicated Contributor

    Can I somehow store the SSH key in the ~/.ssh folder in a Ubuntu 22.04 distro?