@@ -174,7 +174,7 @@ def _clone_command_for_github_like(git_config, dest_dir):
174
174
CalledProcessError: If failed to clone git repo.
175
175
"""
176
176
is_https = git_config ["repo" ].startswith ("https://" )
177
- is_ssh = git_config ["repo" ].startswith ("git@" )
177
+ is_ssh = git_config ["repo" ].startswith ("git@" ) or git_config [ "repo" ]. startswith ( "ssh://" )
178
178
if not is_https and not is_ssh :
179
179
raise ValueError ("Invalid Git url provided." )
180
180
if is_ssh :
@@ -277,12 +277,16 @@ def _run_clone_command(repo_url, dest_dir):
277
277
if repo_url .startswith ("https://" ):
278
278
my_env ["GIT_TERMINAL_PROMPT" ] = "0"
279
279
subprocess .check_call (["git" , "clone" , repo_url , dest_dir ], env = my_env )
280
- elif repo_url .startswith ("git@" ):
281
- with tempfile .NamedTemporaryFile () as sshnoprompt :
282
- with open (sshnoprompt .name , "w" ) as write_pipe :
283
- write_pipe .write ("ssh -oBatchMode=yes $@" )
284
- os .chmod (sshnoprompt .name , 0o511 )
285
- my_env ["GIT_SSH" ] = sshnoprompt .name
280
+ elif repo_url .startswith ("git@" ) or repo_url .startswith ("ssh://" ):
281
+ try :
282
+ with tempfile .NamedTemporaryFile () as sshnoprompt :
283
+ with open (sshnoprompt .name , "w" ) as write_pipe :
284
+ write_pipe .write ("ssh -oBatchMode=yes $@" )
285
+ os .chmod (sshnoprompt .name , 0o511 )
286
+ my_env ["GIT_SSH" ] = sshnoprompt .name
287
+ subprocess .check_call (["git" , "clone" , repo_url , dest_dir ], env = my_env )
288
+ except subprocess .CalledProcessError :
289
+ del my_env ["GIT_SSH" ]
286
290
subprocess .check_call (["git" , "clone" , repo_url , dest_dir ], env = my_env )
287
291
288
292
0 commit comments