python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.42k stars 2.27k forks source link

Prompt for git credentials when trying to install package from private repository when credential cache is empty #9627

Open HYBRID-BEING opened 1 month ago

HYBRID-BEING commented 1 month ago

Issue Kind

Other

Description

One of the dependencies in my project comes from a private repository. I have git's credential.helper set to cache, and sometimes credentials in cache expire before i run poetry install (usually with --sync). This causes following error:

Failed to clone https://***.git, check your git configuration and permissions for this repository.

I understand that this happens due to the fact that Poetry is unable to get credentials from the cache (although, it was a bit confusing at first, as there is nothing wrong with git configuration and permissions), but it would've been nice, if i was prompted for credentials when this happens.

Impact

This would make it more obvious for users, why exactly is Poetry unable to install the package in this particular case. It would also save users from having to cache credentials and re-enter the command, by continuing execution after the prompt.

Workarounds

Executing any git command against repository in question caches credentials and allows Poetry to use credentials until they expire.

dimbleby commented 1 month ago

This is the opposite of #9626, #5880, etc

Generally poetry's intention is not to do interactive stuff during poetry install because it tends to get lost and look like a hang.

HYBRID-BEING commented 1 month ago

Hmm, from what i see, people were reporting that Poetry was getting stuck because prompts would not be shown properly or they had to enter credentials multiple times per Poetry command in -vvv mode. Feels like disabling the prompt is more of a workaround for that, tbh. But if that is the direction Poetry is taking, than i guess i'll just have to deal with it. From what i gathered detecting this won't be easy either (for a separate error message), so maybe, at least, current error message could also mention the credentials (i guess they technically fall under "configuration" part, but i think explicit mention would remedy slight confusion like mine)?