clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
plexus 2021-06-21T07:53:14.061800Z

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.

plexus 2021-06-21T08:02:33.064200Z

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

borkdude 2021-06-21T08:05:08.064500Z

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

plexus 2021-06-21T08:05:44.065100Z

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

borkdude 2021-06-21T08:05:46.065200Z

Not sure about #calva

borkdude 2021-06-21T08:06:01.065500Z

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

borkdude 2021-06-21T08:06:21.065800Z

or .calva/deps.clj.jar -Sdescribe

plexus 2021-06-21T08:07:12.066100Z

Clojure CLI version (deps.clj) 1.10.3.822

plexus 2021-06-21T08:07:18.066300Z

seems that's somewhat behind

borkdude 2021-06-21T08:08:30.066900Z

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

borkdude 2021-06-21T08:08:50.067500Z

(https://github.com/clojure/brew-install/releases)

borkdude 2021-06-21T08:09:59.068700Z

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

borkdude 2021-06-21T08:10:07.069200Z

and see if both work the same with regards to passwords

plexus 2021-06-21T08:10:37.069700Z

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

borkdude 2021-06-21T08:11:20.070Z

Just to be clear, both behave the same?

borkdude 2021-06-21T08:11:33.070400Z

both = the official and deps.clj

plexus 2021-06-21T08:11:52.070900Z

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

plexus 2021-06-21T08:12:26.071300Z

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

borkdude 2021-06-21T08:14:22.072500Z

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

plexus 2021-06-21T08:14:32.073Z

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

borkdude 2021-06-21T08:15:17.073900Z

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

plexus 2021-06-21T08:15:21.074Z

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

borkdude 2021-06-21T08:15:26.074200Z

yes

borkdude 2021-06-21T08:16:03.074700Z

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

borkdude 2021-06-21T08:23:33.075Z

@plexus I found something here which may be useful: https://scoop-docs.vercel.app/docs/guides/Github-with-SSH-key.html

plexus 2021-06-21T08:27:58.076100Z

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

borkdude 2021-06-21T08:28:25.076600Z

perhaps restart powershell?

borkdude 2021-06-21T08:28:31.076800Z

or your computer? dunno :)

plexus 2021-06-21T08:28:43.077Z

valid suggestions at this point ๐Ÿ™‚

plexus 2021-06-21T08:29:40.077400Z

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 
๐Ÿ™ˆ

borkdude 2021-06-21T09:08:56.077800Z

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

borkdude 2021-06-21T09:09:54.079Z

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 :)

pez 2021-06-21T12:09:08.081Z

> 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.

littleli 2021-06-21T12:22:26.081100Z

looks like polluted classpath. clojure -Sforce maybe?

littleli 2021-06-21T12:23:19.081400Z

I remember I ran into this one as well.

alexmiller 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)

alexmiller 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

borkdude 2021-06-21T12:55:14.085300Z

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

borkdude 2021-06-21T12:55:20.085500Z

like you do for error on debug

alexmiller 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?)

alexmiller 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

alexmiller 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.

alexmiller 2021-06-21T13:07:36.089500Z

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

alexmiller 2021-06-21T13:07:44.089700Z

feel free to add stuff there

plexus 2021-06-21T14:37:45.089900Z

Thanks @alexmiller!