Skip to content

Commit 428d11e

Browse files
[Bug]: dstack misconfigures Git credentials for private repos if credential helper(s) configured #3115
1 parent 40903db commit 428d11e

File tree

1 file changed

+2
-1
lines changed
  • src/dstack/_internal/core/services

1 file changed

+2
-1
lines changed

src/dstack/_internal/core/services/repos.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def _get_repo_creds_and_default_branch_https(
122122

123123
def _get_repo_default_branch(url: str, env: dict[str, str]) -> Optional[str]:
124124
# output example: "ref: refs/heads/dev\tHEAD\n545344f77c0df78367085952a97fc3a058eb4c65\tHEAD"
125-
output: str = git.cmd.Git().ls_remote("--symref", url, "HEAD", env=env)
125+
# Disable credential helpers to exclude any default credentials from being used
126+
output: str = git.cmd.Git()(c="credential.helper=").ls_remote("--symref", url, "HEAD", env=env)
126127
for line in output.splitlines():
127128
# line format: `<oid> TAB <ref> LF`
128129
oid, _, ref = line.partition("\t")

0 commit comments

Comments
 (0)