Skip to content

Unable to connect to Sourcehut over SSH on Windows with JJ #4802

@miscoined

Description

@miscoined

Description

I'm currently unable to clone or fetch from repos hosted on Sourcehut with JJ on my Windows device using SSH, but it works without JJ. I thought this might be due to #3322 as I was previously getting the same error with Gituhb, but I was able to bypass it by first connecting with ssh -o HostKeyAlgorithms=ssh-rsa "git@github.com" to force it to populate a known_hosts entry with RSA. After that, jj git clone and others worked fine.

This workaround does not work for Sourcehut. It appears that ssh-rsa isn't a valid host key algorithm for Sourcehut:

PS C:\Users\Kelly\Projects> ssh -o HostKeyAlgorithms=ssh-rsa "git@git.sr.ht"
Unable to negotiate with 46.23.81.155 port 22: no matching host key type found. Their offer: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519

I've tried all of the offered key algorithms (wiping known_hosts again every time) and none of them seem to let jj successfully clone. I'm not sure if this is related to #1419 and is a regression with RSA keys for Sourcehut, or whether it's the same issue as #3322 and that none of the algos offered by Sourcehut are valid workarounds.

Please let me know if there's any other information I can provide or any workarounds I can try. I'll try to find time later to test out #3554 as well and see if it resolves this issue.

Steps to Reproduce the Problem

  1. (Optional, gives a different error message) Run ssh -o HostKeyAlgorithms=rsa-sha2-512 "git@git.sr.ht" to add a ssh-rsa entry for Sourcehut to known_hosts
  2. Try to clone a repo hosted at git@git.sr.ht.

Expected Behavior

Repo should clone

Actual Behavior

Without an entry:

Error: invalid or unknown remote ssh hostkey; class=Ssh (23); code=Certificate (-17)
Hint: Jujutsu uses libssh2, which doesn't respect ~/.ssh/config. Does `ssh -F /dev/null` to the host work?

With an entry in known_hosts:

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

Specifications

  • Platform: Windows 10 19045.5011
  • Version: jj 0.23.0-5de285f5eb727b613434979cd9d83c30cabaffae

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions