Skip to content

Git ssh key issues not reported #771

Closed

Description

@ben-edna

Given a project at git@github.com:dfetch-org/dfetch
When i run dfetch -v check
Then in case of an ssh key issue, no output is given to find the reason why

There is a part that tries to determine the VCS type by doing git ls-remote --heads, but even with more verbosity it doesn't output any additional info.

Activity

  1. spoorcc commented on Oct 18, 2025

    @spoorcc
    Contributor

    Could see If using asyncssh would make it possible to test ssh repo's locally in a cross platform way:

    @given("it is accessible over SSH")
    def step_start_ssh(context):
        import asyncssh, asyncio, os
        repo_dir = context.repo_dir
    
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)
    
        host_key_file = os.path.join(repo_dir, "ssh_host_key")
        asyncssh.generate_private_key("ssh-rsa").write_private_key_file(host_key_file)
    
        class GitSSHServer(asyncssh.SSHServer):
            pass
    
        class GitSSHSession(asyncssh.SSHServerSession):
            def __init__(self):
                self._process = None
    
            def exec_requested(self, command):
                if command.startswith("git-upload-pack") or command.startswith("git-receive-pack"):
                    self._process = subprocess.Popen(
                        command.split(),
                        stdin=subprocess.PIPE,
                        stdout=subprocess.PIPE,
                        stderr=subprocess.PIPE,
                        cwd=repo_dir
                    )
                    return True
                return False
    
            def stdin_received(self, data, datatype):
                if self._process:
                    self._process.stdin.write(data)
                return len(data)
    
            def eof_received(self):
                if self._process:
                    self._process.stdin.close()
                return False
    
            def session_ended(self):
                if self._process:
                    self._process.wait()
    
        server = loop.run_until_complete(
            asyncssh.listen(
                '', 0,
                server_host_keys=[host_key_file],
                server_factory=GitSSHServer,
                username="gituser",
                password="password123",
                session_factory=GitSSHSession
            )
        )
    
        context.ssh_port = server.get_port()
        context.ssh_server = server
        context.ssh_loop = loop
  2. spoorcc commented on Jan 3, 2026

    @spoorcc
    Contributor

    Maybe the BatchMode=yes for the #570 fix in #908 also improves this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions