2

I managed to clone using dulwich with HTTP url, but when I try to clone with SSH, I get a "HangupException". Is it possible that dulwich doesn't get access to the public key in the ~/.ssh folder, and then doesn't manage to do the SSH connection ? Does this need to be added in dulwich configuration ? Here is the error I get:

    error: Application connect timed-out.
fatal: Host key verification failed.
Traceback (most recent call last):
  File "C:\FAST\pycharmcommunity\2016.3.2\helpers\pydev\pydevd.py", line 1596, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\FAST\pycharmcommunity\2016.3.2\helpers\pydev\pydevd.py", line 974, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:/git/lqr_core/backtests/cash/Statistics/ssh_example.py", line 242, in <module>
    example8()
  File "C:/git/lqr_core/backtests/cash/Statistics/ssh_example.py", line 230, in example8
    porcelain.clone(remote_address_ssh, target, errstream=sys.stdout, outstream=sys.stdout)
  File "C:\FAST\anaconda\python27\win64\431\lib\site-packages\dulwich\porcelain.py", line 310, in clone
    progress=errstream.write)
  File "C:\FAST\anaconda\python27\win64\431\lib\site-packages\dulwich\client.py", line 363, in fetch
    progress)
  File "C:\FAST\anaconda\python27\win64\431\lib\site-packages\dulwich\client.py", line 729, in fetch_pack
    refs, server_capabilities = read_pkt_refs(proto)
  File "C:\FAST\anaconda\python27\win64\431\lib\site-packages\dulwich\client.py", line 197, in read_pkt_refs
    for pkt in proto.read_pkt_seq():
  File "C:\FAST\anaconda\python27\win64\431\lib\site-packages\dulwich\protocol.py", line 254, in read_pkt_seq
    pkt = self.read_pkt_line()
  File "C:\FAST\anaconda\python27\win64\431\lib\site-packages\dulwich\protocol.py", line 202, in read_pkt_line
    raise HangupException()
dulwich.errors.HangupException: The remote server unexpectedly closed the connection.
A. Clare
  • 57
  • 5
  • Do recipes from [SSH connection problem with “Host key verification failed…” error](https://askubuntu.com/a/45685) help? Could you connect with ssh manually? – max630 Jan 19 '18 at 10:59

2 Answers2

0

From the stack I can see that it still tries to use http client. You should check what source you provide to the porcelain.clone. You can try what client it would use with client.get_transport_and_path function.

max630
  • 8,762
  • 3
  • 30
  • 55
  • Yes, sorry, you're right, I did a mistake by copying the wrong stack (that was related to a clone with http url). I just updated the question. – A. Clare Jan 19 '18 at 09:02
  • Do you know how one could specify the public key to dulwich? Because it seems to me that the error is that it doesn't automatically go to ~/.ssh to read the public key. Do you have an idea about that? – A. Clare Jan 19 '18 at 17:59
0

I finally solved the issue by using the method precised here: http://poquitopicante.blogspot.co.uk/2012/09/dulwich-porcelain.html

The ssh vendor in dulwich.client should be subclassed by one that has the address of the ssh key pair to enable the connection.

A. Clare
  • 57
  • 5