diff --git a/src/bentoml/_internal/bento/build_config.py b/src/bentoml/_internal/bento/build_config.py index 6a55827e91c..d851751503b 100644 --- a/src/bentoml/_internal/bento/build_config.py +++ b/src/bentoml/_internal/bento/build_config.py @@ -679,8 +679,8 @@ def _fix_dep_urls(self, requirements_txt: str, wheels_folder: str) -> None: filename = link.filename elif link.url.startswith("git+ssh://"): # We are only able to handle SSH Git URLs - url, ref = link.url[4:], "" - if url.count("@") > 1: + url, ref = link.url_without_fragment[4:], "" + if url.count("@") > 1: # ssh://git@owner/repo@ref url, _, ref = url.rpartition("@") filename = download_and_zip_git_repo( url, ref, link.subdirectory_fragment, wheels_folder diff --git a/src/bentoml/_internal/utils/__init__.py b/src/bentoml/_internal/utils/__init__.py index 9893931710a..13e65f34992 100644 --- a/src/bentoml/_internal/utils/__init__.py +++ b/src/bentoml/_internal/utils/__init__.py @@ -297,7 +297,10 @@ def download_and_zip_git_repo( raise BentoMLException( f"Failed to clone git repository {url}: {e.stderr}" ) from e - zipball = os.path.join(dst_path, subdirectory or name) + zipball = os.path.join( + dst_path, + name + (f"-{subdirectory.replace('/', '-')}" if subdirectory else ""), + ) shutil.rmtree(os.path.join(dest_dir, ".git"), ignore_errors=True) source_dir = os.path.join(dest_dir, subdirectory) if subdirectory else dest_dir result = shutil.make_archive(zipball, "zip", source_dir)