Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/scmrepo/git/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def _input_tty(prompt: str = "Username: ") -> str:
from contextlib import ExitStack

if os.name == "nt":
if not sys.stdin.isatty():
raise EOFError
return input(prompt)

with ExitStack() as stack:
Expand All @@ -297,6 +299,8 @@ def _input_tty(prompt: str = "Username: ") -> str:
except OSError:
stack.close()
# fallback to default input()
if not sys.stdin.isatty():
raise
return input(prompt)
try:
stream.write(prompt)
Expand Down Expand Up @@ -365,10 +369,13 @@ def get(
except KeyError:
pass
if interactive:
if self.askpass:
return self._get_interactive(credential, self.askpass.input)
if not os.environ.get("GIT_TERMINAL_PROMPT") == "0":
return self._get_interactive(credential, _input_tty, getpass)
try:
if self.askpass:
return self._get_interactive(credential, self.askpass.input)
if not os.environ.get("GIT_TERMINAL_PROMPT") == "0":
return self._get_interactive(credential, _input_tty, getpass)
except (EOFError, OSError):
pass
raise CredentialNotFoundError("No matching credentials")

def _get_interactive(
Expand Down