Search code examples
gitsshputtyatlassian-sourcetree

Why can't I clone "FATAL ERROR: Server unexpectedly closed network connection"?


When trying to clone a repository, I get an error, what am I doing wrong?
I use putty, ssh access.
I clone a repository from Bitbucket via Sourcetree.

FATAL ERROR: Server unexpectedly closed network connection  
fatal: the remote end hung up unexpectedly  
fatal: early EOF  
fatal: index-pack failed  
Completed with errors, see above.  

If you set Clone depth 1 in the cloning settings (the standard depth is 0) then cloning is performed without errors, but then cloning is superficial and so this does not solve my problem.


Solution

  • This is similar to this thread where, indeed in Sourcetree, changing the clone depth to 1 (under Advanced Options > Clone depth) could help.

    See also "Fix SourceTree: Git over SSH"

    In order to connect to the git repo over SSH, I advise to install the complete PuTTY package from the official WebSite.

    After this, you can copy the latest executables from the PuTTY folder (Depending on the version, usually: C:\Program Files\PuTTY) to the SourceTree folder (Depending on the version, usually: C:\Users\\AppData\Local\SourceTree\app-2.0.20.1\tools\putty)

    • plink.exe
    • (pageant.exe)
    • (puttygen.exe)
    • (putty.exe)

    Now you can configure normally the connection in SourceTree and with this latest version of plink it will work.

    Test also the same clone in command-line, outside of SourceTree, and check if the HTTPS URL would work any better.