question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dulwich does not support Dumb Git transport

See original GitHub issue
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I’m unable to add git dependencies both via https and ssh. If I just do a regular git clone <repo> it works for ssh.

HTTPS

❯ poetry add git+https://github.com:mbuesch/pyprofibus.git -vvv
Using virtualenv: C:\Users\rruiter\Miniconda3\envs\profinet310
[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
[urllib3.connectionpool] Starting new HTTPS connection (1): github.com:443
[urllib3.connectionpool] https://github.com:443 "GET /mbuesch/pyprofibus.git/info/refs?service=git-upload-pack HTTP/1.1" 200 None
Cloning https://github.com/mbuesch/pyprofibus.git at 'HEAD' to C:\Users\rruiter\Miniconda3\envs\profinet310\src\pyprofibus
[urllib3.connectionpool] Starting new HTTPS connection (1): git.bues.ch:443
[urllib3.connectionpool] https://git.bues.ch:443 "GET /git/crcgen.git/info/refs?service=git-upload-pack HTTP/1.1" 200 817

  Stack trace:

  23  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:329 in run
       327β”‚
       328β”‚             try:
     β†’ 329β”‚                 exit_code = self._run(io)
       330β”‚             except Exception as e:
       331β”‚                 if not self._catch_exceptions:

  22  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\application.py:185 in _run
       183β”‚         self._load_plugins(io)
       184β”‚
     β†’ 185β”‚         exit_code: int = super()._run(io)
       186β”‚         return exit_code
       187β”‚

  21  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:423 in _run
       421β”‚             io.input.set_stream(stream)
       422β”‚
     β†’ 423β”‚         exit_code = self._run_command(command, io)
       424β”‚         self._running_command = None
       425β”‚

  20  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:465 in _run_command
       463β”‚
       464β”‚         if error is not None:
     β†’ 465β”‚             raise error
       466β”‚
       467β”‚         return event.exit_code

  19  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:449 in _run_command
       447β”‚
       448β”‚             if event.command_should_run():
     β†’ 449β”‚                 exit_code = command.run(io)
       450β”‚             else:
       451β”‚                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  18  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\commands\base_command.py:119 in run
       117β”‚         io.input.validate()
       118β”‚
     β†’ 119β”‚         status_code = self.execute(io)
       120β”‚
       121β”‚         if status_code is None:

  17  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\commands\command.py:83 in execute
        81β”‚
        82β”‚         try:
     β†’  83β”‚             return self.handle()
        84β”‚         except KeyboardInterrupt:
        85β”‚             return 1

  16  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\add.py:158 in handle
       156β”‚             return 0
       157β”‚
     β†’ 158β”‚         requirements = self._determine_requirements(
       159β”‚             packages,
       160β”‚             allow_prereleases=self.option("allow-prereleases"),

  15  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\init.py:357 in _determine_requirements
       355β”‚
       356β”‚         result = []
     β†’ 357β”‚         for requirement in self._parse_requirements(requires):
       358β”‚             if "git" in requirement or "url" in requirement or "path" in requirement:
       359β”‚                 result.append(requirement)

  14  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\init.py:416 in _parse_requirements
       414β”‚             cwd = Path.cwd()
       415β”‚
     β†’ 416β”‚         return [
       417β”‚             parse_dependency_specification(
       418β”‚                 requirement=requirement,

  13  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\init.py:417 in <listcomp>
       415β”‚
       416β”‚         return [
     β†’ 417β”‚             parse_dependency_specification(
       418β”‚                 requirement=requirement,
       419β”‚                 env=self.env if isinstance(self, EnvCommand) else None,

  12  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\dependency_specification.py:216 in parse_dependency_specification
       214β”‚
       215β”‚     specification = (
     β†’ 216β”‚         _parse_dependency_specification_url(requirement, env=env)
       217β”‚         or _parse_dependency_specification_path(requirement, cwd=cwd)
       218β”‚         or _parse_dependency_specification_simple(requirement)

  11  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\dependency_specification.py:68 in _parse_dependency_specification_url
        66β”‚
        67β”‚     if url_parsed.scheme in ["git+https", "git+ssh"]:
     β†’  68β”‚         return _parse_dependency_specification_git_url(requirement, env)
        69β”‚
        70β”‚     if url_parsed.scheme in ["http", "https"]:

  10  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\dependency_specification.py:49 in _parse_dependency_specification_git_url
        47β”‚
        48β”‚     source_root = env.path.joinpath("src") if env else None
     β†’  49β”‚     package = Provider.get_package_from_vcs(
        50β”‚         "git",
        51β”‚         url=url.url,

   9  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\puzzle\provider.py:341 in get_package_from_vcs
       339β”‚             raise ValueError(f"Unsupported VCS dependency {vcs}")
       340β”‚
     β†’ 341β”‚         return _get_package_from_git(
       342β”‚             url=url,
       343β”‚             branch=branch,

   8  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\puzzle\provider.py:95 in _get_package_from_git
        93β”‚     source_root: Path | None = None,
        94β”‚ ) -> Package:
     β†’  95β”‚     source = Git.clone(
        96β”‚         url=url,
        97β”‚         source_root=source_root,

   7  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:427 in clone
       425β”‚             if not cls.is_using_legacy_client():
       426β”‚                 local = cls._clone(url=url, refspec=refspec, target=target)
     β†’ 427β”‚                 cls._clone_submodules(repo=local)
       428β”‚                 return local
       429β”‚         except HTTPUnauthorized:

   6  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:356 in _clone_submodules
       354β”‚                         continue
       355β”‚
     β†’ 356β”‚                 cls.clone(
       357β”‚                     url=url.decode("utf-8"),
       358β”‚                     source_root=source_root,

   5  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:426 in clone
       424β”‚         try:
       425β”‚             if not cls.is_using_legacy_client():
     β†’ 426β”‚                 local = cls._clone(url=url, refspec=refspec, target=target)
       427β”‚                 cls._clone_submodules(repo=local)
       428β”‚                 return local

   4  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:258 in _clone
       256β”‚             local = Repo(str(target))
       257β”‚
     β†’ 258β”‚         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       259β”‚
       260β”‚         logger.debug(

   3  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:201 in _fetch_remote_refs
       199β”‚
       200β”‚         with local:
     β†’ 201β”‚             result: FetchPackResult = client.fetch(
       202β”‚                 path,
       203β”‚                 local,

   2  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\client.py:837 in fetch
        835β”‚             f, commit, abort = target.object_store.add_pack()
        836β”‚         try:
     β†’  837β”‚             result = self.fetch_pack(
        838β”‚                 path,
        839β”‚                 determine_wants,

   1  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\client.py:2076 in fetch_pack
       2074β”‚         """
       2075β”‚         url = self._get_url(path)
     β†’ 2076β”‚         refs, server_capabilities, url = self._discover_references(
       2077β”‚             b"git-upload-pack", url
       2078β”‚         )

  AttributeError

  'NoneType' object has no attribute 'startswith'

  at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\client.py:1946 in _discover_references
      1942β”‚                 )
      1943β”‚             base_url = resp.redirect_location[: -len(tail)]
      1944β”‚
      1945β”‚         try:
    β†’ 1946β”‚             self.dumb = not resp.content_type.startswith("application/x-git-")
      1947β”‚             if not self.dumb:
      1948β”‚                 proto = Protocol(read, None)
      1949β”‚                 # The first line should mention the service
      1950β”‚                 try:

SSH

❯ poetry add git+ssh://github.com:mbuesch/pyprofibus.git -vvv
Using virtualenv: C:\Users\rruiter\Miniconda3\envs\profinet310

  Stack trace:

  3  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\client.py:1149 in fetch_pack
      1147β”‚         with proto:
      1148β”‚             try:
    β†’ 1149β”‚                 refs, server_capabilities = read_pkt_refs(proto.read_pkt_seq())
      1150β”‚             except HangupException as exc:
      1151β”‚                 raise _remote_error_from_stderr(stderr) from exc

  2  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\client.py:253 in read_pkt_refs
       251β”‚     refs = {}
       252β”‚     # Receive refs from server
    β†’  253β”‚     for pkt in pkt_seq:
       254β”‚         (sha, ref) = pkt.rstrip(b"\n").split(None, 1)
       255β”‚         if sha == b"ERR":

  1  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\protocol.py:277 in read_pkt_seq
      275β”‚             flush-pkt.
      276β”‚         """
    β†’ 277β”‚         pkt = self.read_pkt_line()
      278β”‚         while pkt:
      279β”‚             yield pkt

  HangupException

  The remote server unexpectedly closed the connection.

  at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\protocol.py:220 in read_pkt_line
      216β”‚
      217β”‚         try:
      218β”‚             sizestr = read(4)
      219β”‚             if not sizestr:
    β†’ 220β”‚                 raise HangupException()
      221β”‚             size = int(sizestr, 16)
      222β”‚             if size == 0:
      223β”‚                 if self.report_activity:
      224β”‚                     self.report_activity(4, "read")

The following error occurred when trying to handle this error:


  Stack trace:

  20  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:329 in run
       327β”‚
       328β”‚             try:
     β†’ 329β”‚                 exit_code = self._run(io)
       330β”‚             except Exception as e:
       331β”‚                 if not self._catch_exceptions:

  19  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\application.py:185 in _run
       183β”‚         self._load_plugins(io)
       184β”‚
     β†’ 185β”‚         exit_code: int = super()._run(io)
       186β”‚         return exit_code
       187β”‚

  18  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:423 in _run
       421β”‚             io.input.set_stream(stream)
       422β”‚
     β†’ 423β”‚         exit_code = self._run_command(command, io)
       424β”‚         self._running_command = None
       425β”‚

  17  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:465 in _run_command
       463β”‚
       464β”‚         if error is not None:
     β†’ 465β”‚             raise error
       466β”‚
       467β”‚         return event.exit_code

  16  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py:449 in _run_command
       447β”‚
       448β”‚             if event.command_should_run():
     β†’ 449β”‚                 exit_code = command.run(io)
       450β”‚             else:
       451β”‚                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  15  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\commands\base_command.py:119 in run
       117β”‚         io.input.validate()
       118β”‚
     β†’ 119β”‚         status_code = self.execute(io)
       120β”‚
       121β”‚         if status_code is None:

  14  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\commands\command.py:83 in execute
        81β”‚
        82β”‚         try:
     β†’  83β”‚             return self.handle()
        84β”‚         except KeyboardInterrupt:
        85β”‚             return 1

  13  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\add.py:158 in handle
       156β”‚             return 0
       157β”‚
     β†’ 158β”‚         requirements = self._determine_requirements(
       159β”‚             packages,
       160β”‚             allow_prereleases=self.option("allow-prereleases"),

  12  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\init.py:357 in _determine_requirements
       355β”‚
       356β”‚         result = []
     β†’ 357β”‚         for requirement in self._parse_requirements(requires):
       358β”‚             if "git" in requirement or "url" in requirement or "path" in requirement:
       359β”‚                 result.append(requirement)

  11  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\init.py:416 in _parse_requirements
       414β”‚             cwd = Path.cwd()
       415β”‚
     β†’ 416β”‚         return [
       417β”‚             parse_dependency_specification(
       418β”‚                 requirement=requirement,

  10  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\commands\init.py:417 in <listcomp>
       415β”‚
       416β”‚         return [
     β†’ 417β”‚             parse_dependency_specification(
       418β”‚                 requirement=requirement,
       419β”‚                 env=self.env if isinstance(self, EnvCommand) else None,

   9  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\dependency_specification.py:216 in parse_dependency_specification
       214β”‚
       215β”‚     specification = (
     β†’ 216β”‚         _parse_dependency_specification_url(requirement, env=env)
       217β”‚         or _parse_dependency_specification_path(requirement, cwd=cwd)
       218β”‚         or _parse_dependency_specification_simple(requirement)

   8  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\dependency_specification.py:68 in _parse_dependency_specification_url
        66β”‚
        67β”‚     if url_parsed.scheme in ["git+https", "git+ssh"]:
     β†’  68β”‚         return _parse_dependency_specification_git_url(requirement, env)
        69β”‚
        70β”‚     if url_parsed.scheme in ["http", "https"]:

   7  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\dependency_specification.py:49 in _parse_dependency_specification_git_url
        47β”‚
        48β”‚     source_root = env.path.joinpath("src") if env else None
     β†’  49β”‚     package = Provider.get_package_from_vcs(
        50β”‚         "git",
        51β”‚         url=url.url,

   6  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\puzzle\provider.py:341 in get_package_from_vcs
       339β”‚             raise ValueError(f"Unsupported VCS dependency {vcs}")
       340β”‚
     β†’ 341β”‚         return _get_package_from_git(
       342β”‚             url=url,
       343β”‚             branch=branch,

   5  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\puzzle\provider.py:95 in _get_package_from_git
        93β”‚     source_root: Path | None = None,
        94β”‚ ) -> Package:
     β†’  95β”‚     source = Git.clone(
        96β”‚         url=url,
        97β”‚         source_root=source_root,

   4  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:426 in clone
       424β”‚         try:
       425β”‚             if not cls.is_using_legacy_client():
     β†’ 426β”‚                 local = cls._clone(url=url, refspec=refspec, target=target)
       427β”‚                 cls._clone_submodules(repo=local)
       428β”‚                 return local

   3  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:258 in _clone
       256β”‚             local = Repo(str(target))
       257β”‚
     β†’ 258β”‚         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       259β”‚
       260β”‚         logger.debug(

   2  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\vcs\git\backend.py:201 in _fetch_remote_refs
       199β”‚
       200β”‚         with local:
     β†’ 201β”‚             result: FetchPackResult = client.fetch(
       202β”‚                 path,
       203β”‚                 local,

   1  ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\client.py:837 in fetch
        835β”‚             f, commit, abort = target.object_store.add_pack()
        836β”‚         try:
     β†’  837β”‚             result = self.fetch_pack(
        838β”‚                 path,
        839β”‚                 determine_wants,

  HangupException

  d\\rruiter@github.com: Permission denied (publickey).

  at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\dulwich\client.py:1151 in fetch_pack
      1147β”‚         with proto:
      1148β”‚             try:
      1149β”‚                 refs, server_capabilities = read_pkt_refs(proto.read_pkt_seq())
      1150β”‚             except HangupException as exc:
    β†’ 1151β”‚                 raise _remote_error_from_stderr(stderr) from exc
      1152β”‚             (
      1153β”‚                 negotiated_capabilities,
      1154β”‚                 symrefs,
      1155β”‚                 agent,

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:21 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
jelmercommented, Nov 14, 2022

Glancing over the comments here, it looks like the cause was a mix of two things: an invalidly formatted URL and lack of dumb remote repository support in dulwich (masked by incorrect handling of a missing Content-Type header).

1reaction
jelmercommented, Nov 10, 2022

The None Content-Type is an error handling bug; I agree Dulwich should raise a different exception, but it’s not the root cause of the issues @rruiter87 is hitting

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python implementation of Git β€” dulwich 0.20.46 documentation
It aims to provide an interface to git repos (both local and remote) that doesn't call out to git directly but instead uses...
Read more >
Python implementation of Git β€” dulwich 0.19.12 documentation
This is the Dulwich project. It aims to provide an interface to git repos (both local and remote) that doesn't call out to...
Read more >
Transfer Protocols - Git SCM
This protocol is called β€œdumb” because it requires no Git-specific code on the server side during the transport process; the fetch process is...
Read more >
dulwich Documentation
This is the Dulwich project. It aims to provide an interface to git repos (both local and remote) that doesn't call out to...
Read more >
dulwich-users team mailing list archive - ListHelp
[PATCH] Allow accessing invalidly named refs, but don't allow ... 1) - return transport(host), "/"+path - # if its not git or git+ssh,Β ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found