Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure CLI by

When you misspell the :git/url of a git dependency (or the dep name used to infer a url) the error says :

Cloning: https://github.com/MISSPELLED-ORG-OR-REPO-PATH
Error building classpath. Unable to clone /home/user/.gitlibs/_repos/https/github.com/MISSPELLED-ORG-OR-REPO-PATH
fatal: could not read Username for 'https://github.com': terminal prompts disabled

I find the the 3 sentences confusing since they mention classpath, a local folder, username, and terminal prompts disabled.

It would be great if it more clearly can express that no repo could be found with the provided URL, or at least remove the last sentence fatal: could not read Username for 'https://github.com': terminal prompts disabled which I find misleading.

Maybe the Unable to clone could be followed by the url instead of the local folder also?

1 Answer

0 votes
by

There's really a stack of things here...

Cloning: https://github.com/MISSPELLED-ORG-OR-REPO-PATH

Is an informational message from tools.gitlibs, I think that's ok.

Error building classpath. Unable to clone /home/user/.gitlibs/_repos/https/github.com/MISSPELLED-ORG-OR-REPO-PATH
fatal: could not read Username for 'https://github.com': terminal prompts disabled

This is actually an error turducken combining info from three places:
1. "Error building classpath" is from the Clojure CLI catching an unexpected error floating out of classpath construction - it doesn't know what happened, just something bad, so very generic.
2. The "Unable to clone " part is from tools.gitlibs when it gets an error from shelling out to git,and I agree that it would make more sense to list at least the git url or maybe both url and path there (can be errors with read/write perms on the path too). I will update that for next release.
3. The "fatal: ..." is from git itself basically saying that it tried to authenticate a repository url (https so http auth) but terminal prompts are disabled so it could not do that. I think you will get better errors if you are authenticated about invalid repo at that point.

I am curious what you see for echo $GIT_TERMINAL_PROMPT before the CLI call - is this set to 0 in your environment for some reason?

Similarly, if you can authenticate to github before running the CLI command, you should be seeing either success or a better error.

You can replicate this scenario at the terminal by:

  1. Logging out of github: gh auth logout (presumably you are already logged out here).
  2. Turning off terminal prompts: export GIT_TERMINAL_PROMPT=0
  3. Issuing the command: git clone --quiet --mirror https://github.com/ANY-ORG/ANY-REPO foo:

fatal: could not read Username for 'https://github.com': terminal prompts disabled

by
Thanks for the quick response.
In my case GIT_TERMINAL_PROMPT is not set, and I don't even use `gh` command, maybe that is why?
That output is my experience on a Debian Linux box with just git installed, I don't use any github related tooling.
by
There are likely other configuration options relevant to your git or github, but I'm not sure what they all are. Can you just try the `git clone ...` command at your terminal and see what you get? All the CLI is doing is shelling out to do the same.
by
Yeah, the git output isn't the best either, it never says that the repo doesn't exist. It asks for username and password.

Here I'm typing "strom" instead of "storm" and this is what I get :
```
$ git clone https://github.com/flow-storm/flow-strom-debugger
Cloning into 'flow-strom-debugger'...
Username for 'https://github.com': jpmonettas@gmail.com
Password for 'https://jpmonettas@gmail.com@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/flow-storm/flow-strom-debugger/'
```

So it never says the repo doesn't exist, it complains about authentication. Which is even more misleading because of the previous deprecation warning.
by
This kind of thing is usually a security measure to prevent fishing around for private repos. Private repo https authentication has gotten a lot harder in the last few years with github (for probably good reasons). You can create and use a fine-grained personal access token here as your password now (https://github.com/settings/tokens?type=beta). But really, I'd recommend using ssh auth instead.
...