{"id":15985712,"url":"https://github.com/boostchicken/wsl2-gpg-ssh-agent","last_synced_at":"2026-04-22T12:32:36.282Z","repository":{"id":184105163,"uuid":"429107325","full_name":"boostchicken/wsl2-gpg-ssh-agent","owner":"boostchicken","description":"bridge between windows pageant and wsl2","archived":false,"fork":false,"pushed_at":"2021-11-21T04:01:45.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-20T07:13:16.254Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boostchicken.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-11-17T15:50:23.000Z","updated_at":"2023-07-27T02:51:23.000Z","dependencies_parsed_at":"2023-07-27T04:47:05.249Z","dependency_job_id":null,"html_url":"https://github.com/boostchicken/wsl2-gpg-ssh-agent","commit_stats":null,"previous_names":["boostchicken/wsl2-gpg-ssh-agent"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostchicken%2Fwsl2-gpg-ssh-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostchicken%2Fwsl2-gpg-ssh-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostchicken%2Fwsl2-gpg-ssh-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostchicken%2Fwsl2-gpg-ssh-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boostchicken","download_url":"https://codeload.github.com/boostchicken/wsl2-gpg-ssh-agent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243392298,"owners_count":20283560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T02:24:05.626Z","updated_at":"2025-12-27T16:02:48.326Z","avatar_url":"https://github.com/boostchicken.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wsl2-ssh-pageant\n\n## Motivation\nI use a Yubikey to store a GPG key pair and I like to use this key pair as my SSH key too. GPG on Windows exposes a Pageant style SSH agent and I wanted a way to use this key within WSL2.\n\n## How to use with WSL2\n\n### Prerequisite\nIn order to use `wsl-ssh-pageant` you must have installed `socat` and `ss` on your machine.\n\nFor example, on Ubuntu you can install these by running: `sudo apt install socat iproute2`\n\n### Installation\n1. Download latest version from [release page](https://github.com/BlackReloaded/wsl2-ssh-pageant/releases/latest) and copy `wsl2-ssh-pageant.exe` to your windows home directory (or other location within the windows file system). Then simlink to your `$HOME/.ssh` directory for easy access\n    ```bash\n    windows_destination=\"/mnt/c/Users/Public/Downloads/wsl2-ssh-pageant.exe\"\n    linux_destination=\"$HOME/.ssh/wsl2-ssh-pageant.exe\"\n    wget -O \"$windows_destination\" \"https://github.com/BlackReloaded/wsl2-ssh-pageant/releases/latest/download/wsl2-ssh-pageant.exe\"\n    # Set the executable bit.\n    chmod +x \"$windows_destination\"\n    # Symlink to linux for ease of use later\n    ln -s $windows_destination $linux_destination\n    ```\n2. Add one of the following to your shell configuration (for e.g. `.bashrc`, `.zshrc` or `config.fish`). For advanced configurations consult the documentation of your shell.\n\n#### Bash/Zsh\n\n*SSH:*\n```bash\nexport SSH_AUTH_SOCK=\"$HOME/.ssh/agent.sock\"\nif ! ss -a | grep -q \"$SSH_AUTH_SOCK\"; then\n  rm -f \"$SSH_AUTH_SOCK\"\n  wsl2_ssh_pageant_bin=\"$HOME/.ssh/wsl2-ssh-pageant.exe\"\n  if test -x \"$wsl2_ssh_pageant_bin\"; then\n    (setsid nohup socat UNIX-LISTEN:\"$SSH_AUTH_SOCK,fork\" EXEC:\"$wsl2_ssh_pageant_bin\" \u003e/dev/null 2\u003e\u00261 \u0026)\n  else\n    echo \u003e\u00262 \"WARNING: $wsl2_ssh_pageant_bin is not executable.\"\n  fi\n  unset wsl2_ssh_pageant_bin\nfi\n```\n\n*GPG:*\n```bash\nexport GPG_AGENT_SOCK=\"$HOME/.gnupg/S.gpg-agent\"\nif ! ss -a | grep -q \"$GPG_AGENT_SOCK\"; then\n  rm -rf \"$GPG_AGENT_SOCK\"\n  wsl2_ssh_pageant_bin=\"$HOME/.ssh/wsl2-ssh-pageant.exe\"\n  if test -x \"$wsl2_ssh_pageant_bin\"; then\n    (setsid nohup socat UNIX-LISTEN:\"$GPG_AGENT_SOCK,fork\" EXEC:\"$wsl2_ssh_pageant_bin --gpg S.gpg-agent\" \u003e/dev/null 2\u003e\u00261 \u0026)\n  else\n    echo \u003e\u00262 \"WARNING: $wsl2_ssh_pageant_bin is not executable.\"\n  fi\n  unset wsl2_ssh_pageant_bin\nfi\n```\n\n#### Fish\n\n*SSH:*\n```fish\nset -x SSH_AUTH_SOCK \"$HOME/.ssh/agent.sock\"\nif not ss -a | grep -q \"$SSH_AUTH_SOCK\";\n  rm -f \"$SSH_AUTH_SOCK\"\n  set wsl2_ssh_pageant_bin \"$HOME/.ssh/wsl2-ssh-pageant.exe\"\n  if test -x \"$wsl2_ssh_pageant_bin\";\n    setsid nohup socat UNIX-LISTEN:\"$SSH_AUTH_SOCK,fork\" EXEC:\"$wsl2_ssh_pageant_bin\" \u003e/dev/null 2\u003e\u00261 \u0026\n  else\n    echo \u003e\u00262 \"WARNING: $wsl2_ssh_pageant_bin is not executable.\"\n  end\n  set --erase wsl2_ssh_pageant_bin\nend\n```\n\n*GPG:*\n```fish\nset -x GPG_AGENT_SOCK \"$HOME/.gnupg/S.gpg-agent\"\nif not ss -a | grep -q \"$GPG_AGENT_SOCK\";\n  rm -rf \"$GPG_AGENT_SOCK\"\n  set wsl2_ssh_pageant_bin \"$HOME/.ssh/wsl2-ssh-pageant.exe\"\n  if test -x \"$wsl2_ssh_pageant_bin\";\n    setsid nohup socat UNIX-LISTEN:\"$GPG_AGENT_SOCK,fork\" EXEC:\"$wsl2_ssh_pageant_bin --gpg S.gpg-agent\" \u003e/dev/null 2\u003e\u00261 \u0026\n  else\n    echo \u003e\u00262 \"WARNING: $wsl2_ssh_pageant_bin is not executable.\"\n  end\n  set --erase wsl2_ssh_pageant_bin\nend\n```\n\n## Troubleshooting\n\n### Smartcard is detected in Windows and WSL, but ssh-add -L returns error\nIf this is the first time you using yubikey with windows with gpg4win, please follow the instructions in the link\nhttps://developers.yubico.com/PGP/SSH_authentication/Windows.html\n\n| Make sure ssh support is enabled in the `gpg-agent.conf` and restart `gpg-agent` with the following command\n\n```\ngpg-connect-agent killagent /bye\ngpg-connect-agent /bye\n```\n\n### Agent response times are very slow\nIf ssh,ssh-add,gpg etc are very slow (~15-25 seconds) check that wsl2-ssh-pageant resides on the windows file system. This is due to an issue with the WSL interop documented [here](https://github.com/BlackReloaded/wsl2-ssh-pageant/issues/24) and [here](https://github.com/microsoft/WSL/issues/7591)\n\n## Credit\n\nSome of the code is copied from benpye's [wsl-ssh-pageant](https://github.com/benpye/wsl-ssh-pageant). This code shows how to communicate to pageant.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboostchicken%2Fwsl2-gpg-ssh-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboostchicken%2Fwsl2-gpg-ssh-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboostchicken%2Fwsl2-gpg-ssh-agent/lists"}