clj-on-windows 2021-06-21

Hey everyone, thanks for the help. Another day and now it's my turn to help @ariel figure this out. She's using Calva which bundles deps-clj. Calva is up to date (2.0.200), but not sure if the deps-clj that it bundles is the latest. She has git keys set up in $HOME\.ssh\id_rsa, and set up in github. This is the output we get in Calva.

java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.26.0""}}}" -A:dev -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Cloning: git@github.com:GaiwanTeam/data-tools
Error building classpath. Unable to clone C:\Users\User\.gitlibs\_repos\git@github.com\GaiwanTeam\data-tools
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Jack-in process exited. Status: 1
Doing a git clone in powershell works, it asks for her ssh key password, then clones the repo.

Is Clojure CLi / deps-clj supposed to ask for a password in this case?

@plexus 0.0.15 is the latest deps.clj which is based on (the code of) CLI version "1.10.3.849"

is there a way to figure out which version .calva/deps.clj.jar is?

Not sure about #calva

yeah, you could do .calva/deps.clj.jar --version

or .calva/deps.clj.jar -Sdescribe

Clojure CLI version (deps.clj) 1.10.3.822

seems that's somewhat behind

That Clojure CLI was released on April 3, should already have the git stuff needed I think

you could try using the official Clojure CLI or deps.clj in powershell yourself

and see if both work the same with regards to passwords

We've tried deps.clj in powershell and get the exact same error without it asking for a password.

Just to be clear, both behave the same?

both = the official and deps.clj

We haven't tried Clojure CLI. We've tried deps.clj inside Calva and directly from Powershell.

checking now if she has Clojure CLI, I think we've installed it via scoop before

I suspect the CLI will behave the same, since tools.gitlibs doesn't set stdin to inherit. https://github.com/clojure/tools.gitlibs/blob/master/src/main/clojure/clojure/tools/gitlibs/impl.clj#L27-L40

Upgrading Clojure CLI... seems she has an old version which is where the jgit errors were coming from

Maybe set up the key stuff so you don't need to type passwords?

ok, so that would mean it will never ask for a pwd and we should verify that ssh-agent is working first

And perhaps worth raising an issue for the stdin thing (/cc @alexmiller)

Alex Miller (Clojure team) 2021-06-21T12:52:55.083300Z

so, git has an env var (GIT_TERMINAL_PROMPT) that controls whether it will ask prompts on stdin. tools.gitlibs has a https://github.com/clojure/tools.gitlibs#configuration that controls how this is set (defaults to false, no interactive prompts, should just fail). tools.deps uses the default there. I was planning to set it through the clj and clojure commands to allow terminal use but it looks like I may have forgotten to do this based on a quick search.

We followed that just now actually, ssh -T now works without asking for a password, but git clone git@github.com:... still asks for a password.

perhaps restart powershell?

or your computer? dunno :)

valid suggestions at this point ๐Ÿ™‚

also after scoop update clojure we get this

$ clojure 
Error: Could not find or load main class clojure.main 
Caused by: java.lang.ClassNotFoundException: clojure.main 
๐Ÿ™ˆ

looks like polluted classpath. clojure -Sforce maybe?

I remember I ran into this one as well.

Perhaps try the .calva/deps.clj.jar one?

Btw, I'm also curious in getting git to work properly on Windows. So far I've managed to do it via WSL2 but I'm regularly testing stuff in Windows itself (e.g. for babashka) so getting it work properly there would ease my development too. So far I haven't tried to set it up, but if you get it working, please share what you did :)

> Error: Could not find or load main class clojure.main I also get this with the clojure(/clj tools. Nothing I have tried has helped. deps.clj works for me. Though I havenโ€™t been trying with private git repos.

Alex Miller (Clojure team) 2021-06-21T12:45:48.083100Z

somehow you're not getting the clojure jar on the classpath - using clojure -Sforce -Sverbose -Spath would help to debug (-Sforce may force a classpath recompute such that it starts working)

Alex Miller (Clojure team) 2021-06-21T12:54:56.084700Z

you could try setting GITLIBS_TERMINAL=true when executing to see if that helps in getting an interactive prompt

@alexmiller shouldn't you redirect the process's stdin then as well?

like you do for error on debug

Alex Miller (Clojure team) 2021-06-21T12:57:31.086600Z

yes, that would also be necessary if I missed that (although I thought I had tested this at least on Mac?)

Alex Miller (Clojure team) 2021-06-21T12:58:23.087700Z

another tool that can help debugging is to set GITLIBS_DEBUG=true which will then dump each git command being run - if those commands run at the CLI, then they should run via clojure

Alex Miller (Clojure team) 2021-06-21T13:01:26.089300Z

on mac, you can also get UI dialogs via os x password process via the git credential oracle - I have a todo to track down whether there is some way to control that (I was kind of surprised when I ran into it), not sure how this would manifest on other OS'es.

Alex Miller (Clojure team) 2021-06-21T13:07:36.089500Z

I added https://clojure.atlassian.net/browse/TDEPS-185 to look at all this

Alex Miller (Clojure team) 2021-06-21T13:07:44.089700Z

feel free to add stuff there