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

jj git push is not working for me on Windows #3322

Open
jyn514 opened this issue Mar 18, 2024 · 6 comments · May be fixed by #3554
Open

jj git push is not working for me on Windows #3322

jyn514 opened this issue Mar 18, 2024 · 6 comments · May be fixed by #3554
Labels
🐛bug Something isn't working 🪟Windows

Comments

@jyn514
Copy link
Collaborator

jyn514 commented Mar 18, 2024

Description

whenever i run jj git push, i get one of the two errors:

  • on WSL: Error: invalid or unknown remote ssh hostkey; class=Ssh (23); code=Certificate (-17)
  • on Windows: Error: failed to set hostkey preference: The requested method(s) are not currently supported; class=Ssh (23)

Steps to Reproduce the Problem

i have no idea. i don't believe this is related to my .ssh/config, since ssh -F /dev/null [email protected] succeeds. i have the following env variables set on WSL:

; set | grep '^SSH'
SSH_AGENT_PID=48
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXzGR8a4/agent.47

those aren't set on windows, but ssh-agent is somehow working anyway; at least, ssh-add succeeds.

Expected Behavior

jj is able to push to the remote.

Specifications

  • Platform: Linux windows-desktop 5.10.102.1-microsoft-standard-WSL2 Fix readme typo #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
    • Windows 11 Pro 22621.3296
  • Version: jj 0.15.1-bf76080f42f77cad934d9a5202c7b7d29ab2c890 (although this also happened with 0.14)
@PhilipMetzger PhilipMetzger added the 🐛bug Something isn't working label Mar 18, 2024
@gulbanana
Copy link
Collaborator

the second one might be libgit2/libgit2#6612
iirc i’ve worked around this in the past by ensuring my known_hosts does not contain an ed25519 key for github

@MordechaiHadad
Copy link

I am getting the same issue on windows (not WSL):

PS D:\repos\LeadLens> jj git push -c "@-"
Creating branch push-nroqnvwmpzqn for revision @-
Branch changes to push to origin:
  Add branch push-nroqnvwmpzqn to e06c042721af
Error: Failed to authenticate SSH session: ; class=Ssh (23)
Hint: Jujutsu uses libssh2, which doesn't respect ~/.ssh/config. Does `ssh -F /dev/null` to the host work?

@HybridEidolon
Copy link
Contributor

HybridEidolon commented Apr 20, 2024

Similar issue here; I am cloning a repository from a private GitLab service using Windows and the remote ssh key is ed25519, and getting "Error: Fetch failed: failed to set hostkey preference: The requested method(s) are not currently supported; class=Ssh (23)". If I comment out the known_hosts line, I instead get "Fetch failed: failed to start SSH session: Unable to exchange encryption keys; class=Ssh (23)"

@HybridEidolon
Copy link
Contributor

libssh2 error code 23 is LIBSSH2_ERROR_CHANNEL_UNKNOWN which is either "Packet received for unknown channel" or "Channel not found". That's really strange. This seems to affect jj all the way back to 0.7 (which was what cargo installed for some reason). Is libgit2 doing something it shouldn't?

@HybridEidolon
Copy link
Contributor

I've tracked down the issue. The Windows Cryptography Next Generation API backend for libssh2 do not have support for ED25519 and libssh2-sys is defaulting to use it instead of OpenSSL when targeting win32 (either msvc or mingw). libssh2-sys must be compiled with the openssl-on-win32 feature (and vendored-openssl) in order to use the OpenSSL backend.

All distributions of git on windows use a combination of cygwin and git itself which are all compiled to use openssl, which is why it's not a common issue for windows git users. But when using libgit2 directly, this is something to be conscientious of I guess.

HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 21, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change necessitates Windows users building jj to install openssl via vcpkg
for the target triple x64-windows-static-md when building for MSVC, or otherwise
have OpenSSL available at build time. This should also generally work when
building for MinGW, though I did not try it.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 21, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change necessitates Windows users building jj to install openssl via vcpkg
for the target triple x64-windows-static-md when building for MSVC, or otherwise
have OpenSSL available at build time. This should also generally work when
building for MinGW, though I did not try it.

Fixes jj-vcs#3322
@HybridEidolon HybridEidolon linked a pull request Apr 21, 2024 that will close this issue
4 tasks
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 21, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change necessitates Windows users building jj to install openssl via vcpkg
for the target triple x64-windows-static-md when building for MSVC, or otherwise
have OpenSSL available at build time. This should also generally work when
building for MinGW, though I did not try it.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 21, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change necessitates Windows users building jj to install openssl via vcpkg
for the target triple x64-windows-static-md when building for MSVC, or otherwise
have OpenSSL available at build time. This should also generally work when
building for MinGW, though I did not try it.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 23, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 23, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 24, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue Apr 27, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue May 2, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue May 3, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue May 8, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
HybridEidolon added a commit to HybridEidolon/jj that referenced this issue May 12, 2024
By default, libssh2 uses Windows Cryptography Next Generation when targeting
win32. The wincng backend does not support ED25519, which is a widely-used
algorithm among git hosting services, and in some cases may be the only option
on remotes in certain configurations.

This change adds the feature `openssl-on-win32`, enabling the same one in
`libssh2-sys`, and enables it in the CI release flow, ensuring that release
builds are able to communicate with hosts using ED25519.

Fixes jj-vcs#3322
@Stigjb
Copy link

Stigjb commented Nov 19, 2024

This is also a problem for me, trying to interact with Gitlab. I've installed jj with winget and am on version 0.23.0.

This is what I get in a colocated repo, trying to jj git fetch.

With an empty known_hosts file:

Error: invalid or unknown remote ssh hostkey; class=Ssh (23); code=Certificate (-17)
Hint: The HOME environment variable is not set, and might be required for Git to successfully load certificates. Try setting it to the path of a directory that contains a `.ssh` directory.

With ED25519, which is the default with git:

Error: failed to set hostkey preference: The requested method(s) are not currently supported; class=Ssh (23)
Hint: Jujutsu uses libssh2, which doesn't respect ~/.ssh/config. Does `ssh -F /dev/null` to the host work?

I've tried to use a different hostkey algorithm by running ssh -o HostKeyAlgorithms=ssh-rsa "[email protected]". After running that, I get:

Error: failed to authenticate SSH session: ; class=Ssh (23)
Hint: Jujutsu uses libssh2, which doesn't respect ~/.ssh/config. Does `ssh -F /dev/null` to the host work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working 🪟Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants