Skip to content

Commit 5a70c5d

Browse files
Michael GabilondoMichael Gabilondo
Michael Gabilondo
authored and
Michael Gabilondo
committed
bugfix for private ssh git repo with key
1 parent c12fd49 commit 5a70c5d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/sagemaker/git_utils.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ def _clone_command_for_github_like(git_config, dest_dir):
174174
CalledProcessError: If failed to clone git repo.
175175
"""
176176
is_https = git_config["repo"].startswith("https://")
177-
is_ssh = git_config["repo"].startswith("git@")
177+
#is_ssh = git_config["repo"].startswith("git@")
178+
is_ssh = git_config["repo"].startswith("ssh://")
179+
print (git_config['repo'])
178180
if not is_https and not is_ssh:
179181
raise ValueError("Invalid Git url provided.")
180182
if is_ssh:
@@ -277,14 +279,19 @@ def _run_clone_command(repo_url, dest_dir):
277279
if repo_url.startswith("https://"):
278280
my_env["GIT_TERMINAL_PROMPT"] = "0"
279281
subprocess.check_call(["git", "clone", repo_url, dest_dir], env=my_env)
280-
elif repo_url.startswith("git@"):
282+
#elif repo_url.startswith("git@"):
283+
elif repo_url.startswith("ssh://"):
281284
with tempfile.NamedTemporaryFile() as sshnoprompt:
282285
write_pipe = open(sshnoprompt.name, "w")
283286
write_pipe.write("ssh -oBatchMode=yes $@")
284287
write_pipe.close()
285288
os.chmod(sshnoprompt.name, 0o511)
286-
my_env["GIT_SSH"] = sshnoprompt.name
289+
#my_env["GIT_SSH"] = sshnoprompt.name
290+
#import time
291+
#time.sleep(1)
292+
287293
subprocess.check_call(["git", "clone", repo_url, dest_dir], env=my_env)
294+
#print(subprocess.run(["git", "clone", repo_url, dest_dir], env=my_env, stdout=subprocess.PIPE ,stderr=subprocess.STDOUT))
288295

289296

290297
def _insert_token_to_repo_url(url, token):

0 commit comments

Comments
 (0)