eclipse-jgit / jgit

JGit, the Java implementation of git
https://www.eclipse.org/jgit/
Other
127 stars 37 forks source link

Add more specific error message when trying to access http repositories #18

Closed chriswainformatik closed 8 months ago

chriswainformatik commented 8 months ago

Description

When trying to access a repository via http, the error message should be something like: "You cannot access repositories via http." instead of "Authentication is required but no CredentialsProvider has been registered."

There are probably more cases than http/https which are covered by this error.

Motivation

It helps people finding bugs in their software and/or server configuration.

Alternatives considered

No response

Additional context

I was using BlueJ and my own git server which I misconfigured so that it only used http instead of https. When I tried to checkout a repository from my server I only got the error message mentioned above. It would have saved me a lot of time finding my mistake if the error message had been referring to what the actual problem was.

tomaswolf commented 8 months ago

JGit has no such restriction. It's BlueJ that implements it that way, and the message you got ("Authentication is required but no CredentialsProvider has been registered.") is in fact spot on.

BlueJ sets a CredentialsProvider only if the protocol is "ssh" or "https". It does not do so for plain old "http", so you can do only anonymous clones over plain "http".

Apart from that I notice that BlueJ

tomaswolf commented 8 months ago

Not a problem in JGit.

chriswainformatik commented 8 months ago

Thank you for clarification, I will talk to the BlueJ team again.