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

Cloning from new host via ssh causes spurious error rather than prompting for confirmation and succeeding #1342

Open
ctcjab opened this issue Aug 1, 2024 · 0 comments
Labels

Comments

@ctcjab
Copy link

ctcjab commented Aug 1, 2024

Description

Using jupyterlab-git to clone a repo over ssh when the server is not yet in ~/.ssh/known_hosts causes the following "failed to clone" error:
Screenshot 2024-08-01 at 1 00 48 PM
Clicking "Show" produces the following somewhat spurious error:
Screenshot 2024-08-01 at 1 00 57 PM
The failure is due to jupyterlab-git not handling the case when the host key is not yet in ~/.ssh/known_hosts, so the error message should list that as a potential cause, in addition to the user not having access rights or the repo not existing.

Better yet, jupyterlab-git should handle this case and provide a graphical UI for the user to confirm, similar to how the command line git client exposes this via text UI:

$ git clone ssh://[email protected]:7999/foo/bar.git
Cloning into 'bar'...
The authenticity of host '[bitbucket.example.com]:7999 ([X.Y.Z.W]:7999)' can't be established.
RSA key fingerprint is SHA256:<fingerprint>.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[bitbucket.example.com]:7999' (RSA) to the list of known hosts.
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 18 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (18/18), 560.80 KiB | 24.38 MiB/s, done.

This way the user doesn't have to switch away from jupyterlab-git to the terminal in order to clone the repo, which some less technical users may be unable to do by themselves.

Reproduce

  1. Click "Clone a Repository"
  2. Paste the URL of a git repo that is hosted via SSH and whose host's fingerprint does not appear in ~/.ssh/known_hosts
  3. Click "Clone"

Expected behavior

Provide a user-friendly confirmation ("It looks like this is the first time you're cloning from this server via SSH, do you want to continue?" (perhaps with a "details" button the user can click to reveal more technical details, including the host key fingerprint). Once the user confirms, the confirmation is passed through to ssh so it can update ~/.ssh/known_hosts, and from that point forward the user can successfully use jupyterlab-git to clone from this host via ssh without needing to confirm again.

Context

  • Python package version:
  • Extension version: 0.50.1
  • Git version: 2.34.1
  • Operating System and its version: Ubuntu 22.04 LTS
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible. N/A
Web Browser Output
Paste the output from your browser web console here. N/A
@ctcjab ctcjab added the bug label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant