Search code examples
gitamazon-web-servicesssh-keys

Git Clone Fails - fatal: The remote end hung up unexpectedly. fatal: early EOF fatal: index-pack failed


My computer has proper configuration SSH, I got this error when trying to clone the repository:

I run this command to clone the repository

git clone ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/NewsFeed-library library1

It's giving me an error:

Cloning into 'library1'...

remote: Counting objects: 510, done.

Connection to git-codecommit.us-west-2.amazonaws.com closed by remote

host. fatal: The remote end hung up unexpectedly fatal: early EOF

fatal: index-pack failed

How to resolve this error and why I got this error?


Edit: I have already tried it but did not succeed:

#Windows
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1

and

git config --global ssh.postBuffer 524288000 

Solution

  • If you have an alternative option to clone on http, run any of the below commands in gitbash and try to clone the repository, it should work.

    1. git config --global http.postBuffer 524288000
    2. git config --global http.postBuffer 1048576000

    And, if you don't have the option of http and want to proceed with ssh. You can configure SSH keepAlive either on the client or server.

    Configure on server
    Edit

    ~/.ssh/config  
    ServerAliveInterval 60
    ServerAliveCountMax 5
    

    Configure on client Edit on /etc/ssh/sshd_config

    ClientAliveInterval 60
    ClientAliveCountMax 5
    

    e.g.

    echo 'ClientAliveInterval 60' | sudo tee --append /etc/ssh/sshd_config
    

    EDIT: git config --global ssh.postBuffer 1048576000

    Try increasing the buffer, i face the same probelm in my repository.