Skip to content

Commit b8af780

Browse files
author
Ben Davis
committed
Updated to ensure that the user isn't prompted for username and password when trying to check if a git repo exists if they don't have access
1 parent ceaa31d commit b8af780

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/fastsandpm/_git_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
from __future__ import annotations
5959

6060
import logging
61+
import os
6162
import pathlib
6263
import re
6364
import subprocess
@@ -148,7 +149,8 @@ def remote_exists(remote: str) -> bool:
148149
True if the remote repository exists and is accessible, False otherwise.
149150
"""
150151
proc = subprocess.run(
151-
["git", "ls-remote", remote], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
152+
["git", "ls-remote", remote], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
153+
env={"GIT_TERMINAL_PROMPT": "0", "GIT_ASKPASS": "0", **dict(os.environ)},
152154
)
153155
return proc.returncode == 0
154156

0 commit comments

Comments
 (0)