Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry update hangs when prompted for ssh key passphrase #2825

Closed
danihodovic opened this issue Aug 17, 2020 · 14 comments
Closed

Poetry update hangs when prompted for ssh key passphrase #2825

danihodovic opened this issue Aug 17, 2020 · 14 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@danihodovic
Copy link

Re-opening #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.

@danihodovic danihodovic added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 17, 2020
@danihodovic danihodovic changed the title poetry update hangs forever on cloning protected git repository Poetry update hangs when prompted for ssh key passphrase Aug 17, 2020
@gehring
Copy link

gehring commented Aug 20, 2020

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.

@Izoelektro
Copy link

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.

@abn
Copy link
Member

abn commented Oct 16, 2020

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.

@danihodovic
Copy link
Author

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

@abn
Copy link
Member

abn commented Oct 16, 2020

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

@danihodovic
Copy link
Author

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

@abn
Copy link
Member

abn commented Oct 17, 2020

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.

@Izoelektro
Copy link

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.

@Mpreyzner
Copy link

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

@tector
Copy link

tector commented Jan 29, 2021

This is a super annoying issue :-/
I have to type my SSH Passphrase at least 6 times on each install or update...

Any update on this?
I use the newest version of poetry.

@pietermarsman
Copy link

pietermarsman commented Mar 3, 2021

One way around this is to run ssh-add before running poetry. This will add your ssh identities and remember them until you close your terminal session.

@dimbleby
Copy link
Contributor

fixed at #5880 (and duplicated by #3222)

@hummus
Copy link

hummus commented Oct 21, 2022

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.

(a) ssh passphrase prompting and (2) one-time, on-terminal http password prompting without requiring persistence do seem like desirable use-cases that are already supported by the underlying tools git/ssh and pip. the case I ran into was where i'm on a foreign machine where it is undesirable to persist creds but I do want to install once from somewhere I have access.

would you still be open to a change which retains user/env-specified GIT_TERMINAL_PROMPT behavior? maybe something like

  1. errors and does not block when not attached to a TTY (OR if poetry itself cannot prompt for some reason)
  2. does block and prompt for passphrase when attached to a TTY (when underlying git client is prompting)

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

9 participants