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

Can't cider-jack-in to projects with private git dependencies #3601

Open
PavlosMelissinos opened this issue Dec 31, 2023 · 7 comments
Open

Comments

@PavlosMelissinos
Copy link

PavlosMelissinos commented Dec 31, 2023

Expected behavior

cider-jack-in works in projects with private git repos

Actual behavior

I'm getting some text in the nrepl-server buffer that asks for my passphrase but there's no interactive prompt, so I can't provide it to complete the process. Here's the exact message "prompt" as it appears in the nrepl buffer:

Cloning: git@github.com:org/private-repo-name.git

Enter passphrase for key '/home/pavlos/.ssh/id_ed25519': 

Steps to reproduce the problem

Create a deps.edn with the following contents

{:deps {foo/bar {:git/url "git@github.com:org/private-repo-name.git"
                 :sha     "sha"}}}

where org/private-repo-name is a private repo

Run M-x cider-jack-in

Environment & Version information

CIDER version information

;; CIDER 1.12.0 (Split), nREPL 1.0.0
;; Clojure 1.11.1, Java 21.0.1

Lein / Clojure CLI version

Clojure CLI version 1.11.1.1149

Emacs version

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0)

Operating system

Fedora 39

JDK distribution

openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment (Red_Hat-21.0.1.0.12-4) (build 21.0.1+12)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.1.0.12-4) (build 21.0.1+12, mixed mode, sharing)
@PavlosMelissinos
Copy link
Author

PavlosMelissinos commented Dec 31, 2023

In case anyone else is facing this, here are some workarounds:

  1. Spawn a standalone cider/nrepl server and cider-connect to it, as described in the docs
  2. Download the dependencies with clojure -P and then rerun cider-jack-in

(Many thanks to @vemv and @dpsutton from Clojurians slack for the suggestions)

@vemv
Copy link
Member

vemv commented Dec 31, 2023

Hi!

Thanks much for the report.

I'll try to repro it, anyway could you please provide the exact prompt text?

@PavlosMelissinos
Copy link
Author

PavlosMelissinos commented Dec 31, 2023

Good point, it's:

Cloning: git@github.com:org/private-repo-name.git

Enter passphrase for key '/home/pavlos/.ssh/id_ed25519': 

Like I said it only appears in the REPL nrepl-server buffer (and it's not interactive)
I've added it to the initial description too

@vemv
Copy link
Member

vemv commented Jan 1, 2024

Are you able to git-clone the same repo using e.g. Magit?

If not, it could indicate a generalized issue in your Emacs setup, such that ssh-add isn't being correctly invoked.

Example:

[...] You can confirm this by running eval $(ssh-agent); ssh-add ~/.ssh/id_rsa in a terminal, and then in the same terminal emacs &.

That solution isn't exactly ergonomic, but it would be a start.

Please try that specific approach for CIDER and/or Magit, allowing us to discard hypotheses.

Thanks - V

@PavlosMelissinos
Copy link
Author

Are you able to git-clone the same repo using e.g. Magit?

Yes! If I delete the cache from .gitlibs and run magit-clone directly I get the correct prompt (same message but interactive)

@vemv
Copy link
Member

vemv commented Jan 1, 2024

Thanks!

To be clear, is your expected workflow entering the passphrase each time? It would make sense, although perhaps in your terminal emulator you don't have to?

@PavlosMelissinos
Copy link
Author

PavlosMelissinos commented Jan 1, 2024

is your expected workflow entering the passphrase each time

I believe that depends on how the ssh agent is set up. So it doesn't happen always (I think) but:

  • when ssh-agent needs a passphrase I expect emacs/CIDER to ask for the user input correctly (magit-clone does so, so I assume it's caused by something that happens somewhere between the git and cider abstraction levels)
  • when a passphrase isn't necessary, I expect CIDER to be able to clone the repo and then start the REPL (neither happens in my case, CIDER gets stuck "waiting" for user input that will never come).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants