Poetry: Poetry update hangs when prompted for ssh key passphrase

Created on 17 Aug 2020  路  9Comments  路  Source: python-poetry/poetry

Re-opening https://github.com/python-poetry/poetry/issues/446 which was automatically closed.

I successfully added private git repository using poetry add --git ssh://git@gitlab_url/username/repository_name.git package_name. Then I ran poetry update, but it hanged forever on cloning repository (there: https://github.com/sdispater/poetry/blob/master/poetry/vcs/git.py#L99). The problem is that I have to authenticate using my ssh key for cloning repository, git asks for the passphrase, but I cannot enter it.

Bug Triage

Most helpful comment

I have the same problem with resources from https not ssh. Exception with explanation why it failed would be sufficient for me.

All 9 comments

I ran into a similar issue when authenticating with https, e.g., poetry add git+https://github.com/username/my_private_repo.git. Oddly enough, running it with -vvv allowed me to run it to completion but I had to type in my login info 4 different times!

I had to type it in 1) at the start, 2) while "resolving dependencies", 3) in between "writing lock file" and "Package operations: 1 install, [...]", and 4) at the very end after the final " - Installing my_private_package ..." message.

Confirming that this is still an issue as of Poetry version 1.1.3.

It seems as if the poetry CLI/prompt overshadows the Git one - I am assuming this because for me the poetry prompt (without verbosity) keeps flashing and at times shows the Git prompt. I have even managed to make it work simply by guessing when the Git prompt appeared and typing in my username and passphrase multiple times.

This would explain the current issue (#446) as well as #863 (which was observed to be related already). Funnily enough, they have a similar issue over at pipenv. Seeing as the CL package used by poetry is built by hand as it is, I am guessing it should not be that hard to solve this (although I am far from capable of doing it). I see why it would not be of high priority to do so however.

It seems that it might be senisble to disable interactions for the git client and document that cases that need credentials should really use https://git-scm.com/docs/gitcredentials.

@abn Can't you forward stdin / stdout between the git subprocess to the user process when the password prompt is triggered?

I suspect that will cause more problems than it solves. For example, when multiple operations happen in parallel. Better to keep this simple.

Usually the ssh key is prompted for once and saved in the ssh-agent.

Yeah but the issue is when multiple processes request at the same time. I'm inclined to day that it's safer to document this and error out gracefully. Maybe even a detailed message on what to try.

From a user standpoint, git credentials do a fairly good job of solving it. Just documenting the issue would already help quite a lot in my opinion. Simply as an idea, would command-line options to provide credentials be a possible solution? That would likely cause some 'bloat' (verbosity) in the commands however.

I have the same problem with resources from https not ssh. Exception with explanation why it failed would be sufficient for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ambv picture ambv  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments

sobolevn picture sobolevn  路  3Comments

Euphorbium picture Euphorbium  路  3Comments

etijskens picture etijskens  路  3Comments