You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was initially raised as python-poetry/poetry#10167, but I was asked to open an issue here instead
Description
When installing a private Git dependencies of a project, with a global Git configuration that uses url.insteadOfpoetry install in poetry>2 (using dulwich >=0.22.6,<0.23.0) fails with a dulwich error. This is a setup in GitLab CI pipelines to install dependencies from internal Git repositories without setting up / deploying to additional PyPI repositories. Using poetry<2 with dulwich ^0.21.2 this error does not happen.
HangupException
The remote server unexpectedly closed the connection.
at ~/.local/pipx/venvs/poetry/lib/python3.10/site-packages/dulwich/protocol.py:219 in read_pkt_line
215│
216│ try:
217│ sizestr = read(4)
218│ if not sizestr:
→ 219│ raise HangupException()
220│ size = int(sizestr, 16)
221│ if size == 0:
222│ if self.report_activity:
223│ self.report_activity(4, "read")
In the CI pipeline the Git URL replacement is configured in the before_script section using:
When reproducing the issue manually, poetry (probably dulwich under the hood) prompts for a host key verification which indicates that SSH is used for cloning the package instead of HTTPS as configured in the gitconfig.
The authenticity of host 'gitlab.acme.com (172.23.1.12)' can't be established.
ED25519 key fingerprint is SHA256:cjWQPU5PdrmIwNFk61/cRzi/lXg2n18evVMojxsHfww.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? no
Reproduction
Unfortunately I was not able to properly reproduce this with the dulwich cli as clones fail with both dulwich 0.22.7 and dulwich 0.21.7.
Any hints how I can properly reproduce it?
root@a03d70301fe7:/# git config --global url."https://${USER}:${TOKEN}@github.com/".insteadOf "[email protected]:"root@a03d70301fe7:/# git clone [email protected]:some-private-repo.gitCloning into 'kangaroo1'...remote: Enumerating objects: 21, done.remote: Counting objects: 100% (21/21), done.remote: Compressing objects: 100% (14/14), done.remote: Total 21 (delta 2), reused 18 (delta 2), pack-reused 0 (from 0)Receiving objects: 100% (21/21), 37.00 KiB | 1.12 MiB/s, done.Resolving deltas: 100% (2/2), done.root@a03d70301fe7:/# rm -rf some-private-reporoot@a03d70301fe7:/# pipx list | grep dulwich package dulwich 0.22.7, installed using Python 3.12.3 - dulwichroot@a03d70301fe7:/# dulwich clone [email protected]:some-private-repo.gitTraceback (most recent call last): File "/root/.local/bin/dulwich", line 8, in <module> sys.exit(main()) ^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/cli.py", line 863, in main return cmd_kls().run(argv[1:]) ^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/cli.py", line 306, in run porcelain.clone( File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/porcelain.py", line 559, in clone return client.clone( ^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 874, in clone result = self.fetch( ^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 981, in fetch result = self.fetch_pack( ^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 2660, in fetch_pack refs, server_capabilities, url, symrefs, peeled = self._discover_references( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 2432, in _discover_references resp, read = self._http_request(url, headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 2841, in _http_request raise HTTPUnauthorized(resp.headers.get("WWW-Authenticate"), url)dulwich.client.HTTPUnauthorized: No valid credentials providedroot@a03d70301fe7:/# pipx install --force "dulwich<0.22"Installing to existing venv 'dulwich' installed package dulwich 0.21.7, installed using Python 3.12.3 These apps are now globally available - dul-receive-pack - dul-upload-pack - dulwichdone! ✨ 🌟 ✨root@a03d70301fe7:/# dulwich clone [email protected]:jonasehrlich/kangaroo1.gitTraceback (most recent call last): File "/root/.local/bin/dulwich", line 8, in <module> sys.exit(main()) ^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/cli.py", line 823, in main return cmd_kls().run(argv[1:]) ^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/cli.py", line 279, in run porcelain.clone( File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/porcelain.py", line 546, in clone return client.clone( ^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 753, in clone result = self.fetch(path, target, progress=progress, depth=depth) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 839, in fetch result = self.fetch_pack( ^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 2156, in fetch_pack refs, server_capabilities, url = self._discover_references( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 2012, in _discover_references resp, read = self._http_request(url, headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/pipx/venvs/dulwich/lib/python3.12/site-packages/dulwich/client.py", line 2292, in _http_request raise HTTPUnauthorized(resp.headers.get("WWW-Authenticate"), url)dulwich.client.HTTPUnauthorized: No valid credentials provided
poetry install log
poetry-install.log
root@fe2b0c78534d:/workspaces/myrepo# poetry install -vvv
Loading configuration file /root/.config/pypoetry/config.toml
Trying to detect current active python executable as specified in the config.
Found: /usr/local/bin/python
Trying to detect current active python executable as specified in the config.
Found: /usr/local/bin/python
Creating virtualenv myrepo-dB_rVOTu-py3.11 in /root/.cache/pypoetry/virtualenvs
[virtualenv:virtualenv.discovery.builtin] find interpreter for spec PythonSpec(path=/root/.local/pipx/venvs/poetry/bin/python)
[virtualenv:virtualenv.info] filesystem is case-sensitive
[filelock:filelock] Attempting to acquire lock 139951967103376 on /root/.local/share/virtualenv/py_info/2/1a1af0ee75eeea9e2e1ee996c87e7a2b11a0bebd85af04bb136d915cefc0abce.lock
[filelock:filelock] Lock 139951967103376 acquired on /root/.local/share/virtualenv/py_info/2/1a1af0ee75eeea9e2e1ee996c87e7a2b11a0bebd85af04bb136d915cefc0abce.lock
[virtualenv:virtualenv.app_data.via_disk_folder] got python info of %s from (PosixPath('/usr/local/bin/python3.11'), PosixPath('/root/.local/share/virtualenv/py_info/2/1a1af0ee75eeea9e2e1ee996c87e7a2b11a0bebd85af04bb136d915cefc0abce
.json'))
[filelock:filelock] Attempting to release lock 139951967103376 on /root/.local/share/virtualenv/py_info/2/1a1af0ee75eeea9e2e1ee996c87e7a2b11a0bebd85af04bb136d915cefc0abce.lock
[filelock:filelock] Lock 139951967103376 released on /root/.local/share/virtualenv/py_info/2/1a1af0ee75eeea9e2e1ee996c87e7a2b11a0bebd85af04bb136d915cefc0abce.lock
[virtualenv:virtualenv.discovery.builtin] proposed PythonInfo(spec=CPython3.11.11.final.0-64, exe=/usr/local/bin/python3.11, platform=linux, version='3.11.11 (main, Feb 4 2025, 04:55:09) [GCC 12.2.0]', encoding_fs_io=utf-8-utf-8)
[virtualenv:virtualenv.discovery.builtin] accepted PythonInfo(spec=CPython3.11.11.final.0-64, exe=/usr/local/bin/python3.11, platform=linux, version='3.11.11 (main, Feb 4 2025, 04:55:09) [GCC 12.2.0]', encoding_fs_io=utf-8-utf-8)
[virtualenv:virtualenv.run.session] create virtual environment via CPython3Posix(dest=/root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11, clear=False, no_vcs_ignore=False, global=False)
[virtualenv:virtualenv.util.path._sync] create folder /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin
[virtualenv:virtualenv.util.path._sync] create folder /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/lib/python3.11/site-packages
[virtualenv:virtualenv.create.pyenv_cfg] write /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/pyvenv.cfg
[virtualenv:virtualenv.create.pyenv_cfg] home = /usr/local/bin
[virtualenv:virtualenv.create.pyenv_cfg] implementation = CPython
[virtualenv:virtualenv.create.pyenv_cfg] version_info = 3.11.11.final.0
[virtualenv:virtualenv.create.pyenv_cfg] virtualenv = 20.29.1
[virtualenv:virtualenv.create.pyenv_cfg] include-system-site-packages = false
[virtualenv:virtualenv.create.pyenv_cfg] base-prefix = /usr/local
[virtualenv:virtualenv.create.pyenv_cfg] base-exec-prefix = /usr/local
[virtualenv:virtualenv.create.pyenv_cfg] base-executable = /usr/local/bin/python3.11
[virtualenv:virtualenv.util.path._sync] symlink /usr/local/bin/python3.11 to /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin/python
[virtualenv:virtualenv.create.via_global_ref.api] create virtualenv import hook file /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/lib/python3.11/site-packages/_virtualenv.pth
[virtualenv:virtualenv.create.via_global_ref.api] create /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/lib/python3.11/site-packages/_virtualenv.py
[virtualenv:virtualenv.run.session] ============================== target debug ==============================
[virtualenv:virtualenv.create.creator] debug via /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin/python /root/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/create/debug.py
[virtualenv:virtualenv.run.session] {
[virtualenv:virtualenv.run.session] "sys": {
[virtualenv:virtualenv.run.session] "executable": "/root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin/python",
[virtualenv:virtualenv.run.session] "_base_executable": "/usr/local/bin/python3.11",
[virtualenv:virtualenv.run.session] "prefix": "/root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11",
[virtualenv:virtualenv.run.session] "base_prefix": "/usr/local",
[virtualenv:virtualenv.run.session] "real_prefix": null,
[virtualenv:virtualenv.run.session] "exec_prefix": "/root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11",
[virtualenv:virtualenv.run.session] "base_exec_prefix": "/usr/local",
[virtualenv:virtualenv.run.session] "path": [
[virtualenv:virtualenv.run.session] "/usr/local/lib/python311.zip",
[virtualenv:virtualenv.run.session] "/usr/local/lib/python3.11",
[virtualenv:virtualenv.run.session] "/usr/local/lib/python3.11/lib-dynload",
[virtualenv:virtualenv.run.session] "/root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/lib/python3.11/site-packages"
[virtualenv:virtualenv.run.session] ],
[virtualenv:virtualenv.run.session] "meta_path": [
[virtualenv:virtualenv.run.session] "<class '_virtualenv._Finder'>",
[virtualenv:virtualenv.run.session] "<class '_frozen_importlib.BuiltinImporter'>",
[virtualenv:virtualenv.run.session] "<class '_frozen_importlib.FrozenImporter'>",
[virtualenv:virtualenv.run.session] "<class '_frozen_importlib_external.PathFinder'>"
[virtualenv:virtualenv.run.session] ],
[virtualenv:virtualenv.run.session] "fs_encoding": "utf-8",
[virtualenv:virtualenv.run.session] "io_encoding": "utf-8"
[virtualenv:virtualenv.run.session] },
[virtualenv:virtualenv.run.session] "version": "3.11.11 (main, Feb 4 2025, 04:55:09) [GCC 12.2.0]",
[virtualenv:virtualenv.run.session] "makefile_filename": "/usr/local/lib/python3.11/config-3.11-x86_64-linux-gnu/Makefile",
[virtualenv:virtualenv.run.session] "os": "<module 'os' (frozen)>",
[virtualenv:virtualenv.run.session] "site": "<module 'site' (frozen)>",
[virtualenv:virtualenv.run.session] "datetime": "<module 'datetime' from '/usr/local/lib/python3.11/datetime.py'>",
[virtualenv:virtualenv.run.session] "math": "<module 'math' from '/usr/local/lib/python3.11/lib-dynload/math.cpython-311-x86_64-linux-gnu.so'>",
[virtualenv:virtualenv.run.session] "json": "<module 'json' from '/usr/local/lib/python3.11/json/__init__.py'>"
[virtualenv:virtualenv.run.session] }
[virtualenv:virtualenv.run.session] add seed packages via FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
[virtualenv:virtualenv.seed.embed.via_app_data.via_app_data] install pip from wheel /root/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/pip-24.3.1-py3-none-any.whl via CopyPipInstall
[filelock:filelock] Attempting to acquire lock 139951964774032 on /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.3.1-py3-none-any.lock
[filelock:filelock] Lock 139951964774032 acquired on /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.3.1-py3-none-any.lock
[filelock:filelock] Attempting to release lock 139951964774032 on /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.3.1-py3-none-any.lock
[filelock:filelock] Lock 139951964774032 released on /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.3.1-py3-none-any.lock
[virtualenv:virtualenv.util.path._sync] copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.3.1-py3-none-any/pip to /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/lib/python3.11/site-packa
ges/pip
[virtualenv:virtualenv.util.path._sync] copy directory /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.3.1-py3-none-any/pip-24.3.1.dist-info to /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/lib/pyth
on3.11/site-packages/pip-24.3.1.dist-info
[virtualenv:virtualenv.util.path._sync] copy /root/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.3.1-py3-none-any/pip-24.3.1.virtualenv to /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/lib/python3.11/si
te-packages/pip-24.3.1.virtualenv
[distlib:distlib.util] changing mode of /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin/pip-3.11 to 755
[distlib:distlib.util] changing mode of /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin/pip3 to 755
[distlib:distlib.util] changing mode of /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin/pip3.11 to 755
[distlib:distlib.util] changing mode of /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/bin/pip to 755
[virtualenv:virtualenv.seed.embed.via_app_data.pip_install.base] generated console scripts pip-3.11 pip3.11 pip pip3
[virtualenv:virtualenv.run.session] add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
[virtualenv:virtualenv.create.pyenv_cfg] write /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11/pyvenv.cfg
[virtualenv:virtualenv.create.pyenv_cfg] home = /usr/local/bin
[virtualenv:virtualenv.create.pyenv_cfg] implementation = CPython
[virtualenv:virtualenv.create.pyenv_cfg] version_info = 3.11.11.final.0
[virtualenv:virtualenv.create.pyenv_cfg] virtualenv = 20.29.1
[virtualenv:virtualenv.create.pyenv_cfg] include-system-site-packages = false
[virtualenv:virtualenv.create.pyenv_cfg] base-prefix = /usr/local
[virtualenv:virtualenv.create.pyenv_cfg] base-exec-prefix = /usr/local
[virtualenv:virtualenv.create.pyenv_cfg] base-executable = /usr/local/bin/python3.11
[virtualenv:virtualenv.create.pyenv_cfg] prompt = myrepo-py3.11
Using virtualenv: /root/.cache/pypoetry/virtualenvs/myrepo-dB_rVOTu-py3.11
Updating dependencies
Resolving dependencies...
1: fact: myrepo is 0.1.0
1: derived: myrepo
The authenticity of host 'gitlab.acme.com (172.23.1.12)' can't be established.
ED25519 key fingerprint is SHA256:cjWQPU5PdrmIwNFk61/cRzi/lXg2n18evVMojxsHfww.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? no
1: Version solving took 70.241 seconds.
1: Tried 1 solutions.
Stack trace:
26 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
25 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/application.py:236 in _run
234│
235│ with directory(self._working_directory):
→ 236│ exit_code: int = super()._run(io)
237│
238│ return exit_code
24 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
23 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
22 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:457 in _run_command
455│
456│ if command_event.command_should_run():
→ 457│ exit_code = command.run(io)
458│ else:
459│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
21 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/commands/base_command.py:117 in run
115│ io.input.validate()
116│
→ 117│ return self.execute(io) or 0
118│
119│ def merge_application_definition(self, merge_args: bool = True) -> None:
20 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/commands/command.py:61 in execute
59│
60│ try:
→ 61│ return self.handle()
62│ except KeyboardInterrupt:
63│ return 1
19 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/commands/install.py:173 in handle
171│ self.installer.verbose(self.io.is_verbose())
172│
→ 173│ return_code = self.installer.run()
174│
175│ if return_code != 0:
18 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/installation/installer.py:103 in run
101│ self.verbose(True)
102│
→ 103│ return self._do_install()
104│
105│ def dry_run(self, dry_run: bool = True) -> Installer:
17 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/installation/installer.py:241 in _do_install
239│ source_root=self._env.path.joinpath("src")
240│ ):
→ 241│ solved_packages = solver.solve(
242│ use_latest=self._whitelist
243│ ).get_solved_packages()
16 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/puzzle/solver.py:85 in solve
83│ with self._progress(), self._provider.use_latest_for(use_latest or []):
84│ start = time.time()
→ 85│ packages = self._solve()
86│ # simplify markers by removing redundant information
87│ for transitive_info in packages.values():
15 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/puzzle/solver.py:166 in _solve
164│
165│ try:
→ 166│ result = resolve_version(self._package, self._provider)
167│
168│ packages = result.packages
14 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/mixology/__init__.py:18 in resolve_version
16│ solver = VersionSolver(root, provider)
17│
→ 18│ return solver.solve()
19│
13 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/mixology/version_solver.py:174 in solve
172│ while next is not None:
173│ self._propagate(next)
→ 174│ next = self._choose_package_version()
175│
176│ return self._result()
12 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/mixology/version_solver.py:514 in _choose_package_version
512│ package = locked
513│
→ 514│ package = self._provider.complete_package(package)
515│
516│ conflict = False
11 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/puzzle/provider.py:545 in complete_package
543│ if locked is not None and locked.package.is_same_package_as(dep):
544│ continue
→ 545│ self.search_for_direct_origin_dependency(dep)
546│
547│ dependencies = self._get_dependencies_with_overrides(_dependencies, package)
10 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/puzzle/provider.py:218 in search_for_direct_origin_dependency
216│ elif dependency.is_vcs():
217│ dependency = cast("VCSDependency", dependency)
→ 218│ package = self._search_for_vcs(dependency)
219│
220│ elif dependency.is_file():
9 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/puzzle/provider.py:293 in _search_for_vcs
291│ and get the information we need by checking out the specified reference.
292│ """
→ 293│ package = self._direct_origin.get_package_from_vcs(
294│ dependency.vcs,
295│ dependency.source,
8 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/packages/direct_origin.py:116 in get_package_from_vcs
114│ raise ValueError(f"Unsupported VCS dependency {vcs}")
115│
→ 116│ return _get_package_from_git(
117│ url=url,
118│ branch=branch,
7 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/packages/direct_origin.py:34 in _get_package_from_git
32│ source_root: Path | None = None,
33│ ) -> Package:
→ 34│ source = Git.clone(
35│ url=url,
36│ source_root=source_root,
6 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/vcs/git/backend.py:453 in clone
451│ try:
452│ if not cls.is_using_legacy_client():
→ 453│ local = cls._clone(url=url, refspec=refspec, target=target)
454│ cls._clone_submodules(repo=local)
455│ return local
5 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/vcs/git/backend.py:270 in _clone
268│ local = Repo(str(target))
269│
→ 270│ remote_refs = cls._fetch_remote_refs(url=url, local=local)
271│
272│ logger.debug(
4 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/vcs/git/backend.py:215 in _fetch_remote_refs
213│
214│ with local:
→ 215│ result: FetchPackResult = client.fetch(
216│ path,
217│ local,
3 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/dulwich/client.py:981 in fetch
979│ f, commit, abort = target.object_store.add_pack()
980│ try:
→ 981│ result = self.fetch_pack(
982│ path,
983│ determine_wants,
2 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/dulwich/client.py:1352 in fetch_pack
1350│ raise ValueError(f"unknown Git protocol version {protocol_version}")
1351│ proto, can_read, stderr = self._connect(b"upload-pack", path, protocol_version)
→ 1352│ server_protocol_version = negotiate_protocol_version(proto)
1353│ if server_protocol_version not in GIT_PROTOCOL_VERSIONS:
1354│ raise ValueError(
1 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/dulwich/client.py:259 in negotiate_protocol_version
257│
258│ def negotiate_protocol_version(proto) -> int:
→ 259│ pkt = proto.read_pkt_line()
260│ if pkt is not None and pkt.strip() == b"version 2":
261│ return 2
HangupException
The remote server unexpectedly closed the connection.
at ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/dulwich/protocol.py:255 in read_pkt_line
251│
252│ try:
253│ sizestr = read(4)
254│ if not sizestr:
→ 255│ raise HangupException
256│ size = int(sizestr, 16)
257│ if size == 0 or size == 1: # flush-pkt or delim-pkt
258│ if self.report_activity:
259│ self.report_activity(4, "read")
The text was updated successfully, but these errors were encountered:
Description
When installing a private Git dependencies of a project, with a global Git configuration that uses
url.insteadOf
poetry install
inpoetry>2
(usingdulwich >=0.22.6,<0.23.0
) fails with adulwich
error. This is a setup in GitLab CI pipelines to install dependencies from internal Git repositories without setting up / deploying to additional PyPI repositories. Usingpoetry<2
withdulwich ^0.21.2
this error does not happen.In the CI pipeline the Git URL replacement is configured in the
before_script
section using:When reproducing the issue manually, poetry (probably dulwich under the hood) prompts for a host key verification which indicates that SSH is used for cloning the package instead of HTTPS as configured in the gitconfig.
Reproduction
Unfortunately I was not able to properly reproduce this with the
dulwich
cli as clones fail with bothdulwich 0.22.7
anddulwich 0.21.7
.Any hints how I can properly reproduce it?
poetry install
logpoetry-install.log
The text was updated successfully, but these errors were encountered: