Skip to content

Commit

Permalink
Fix cloning large repositories
Browse files Browse the repository at this point in the history
Ignore the error on close when the connection is already closed

Fixes go-git#70
  • Loading branch information
dcu committed Mar 25, 2021
1 parent bf3471d commit 2b4fdd7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plumbing/transport/ssh/common.go
Expand Up @@ -3,7 +3,9 @@ package ssh

import (
"context"
"errors"
"fmt"
"net"
"reflect"
"strconv"

Expand Down Expand Up @@ -90,8 +92,13 @@ func (c *command) Close() error {
//XXX: If did read the full packfile, then the session might be already
// closed.
_ = c.Session.Close()
err := c.client.Close()

return c.client.Close()
if errors.Is(err, net.ErrClosed) {
return nil
}

return err
}

// connect connects to the SSH server, unless a AuthMethod was set with
Expand Down

0 comments on commit 2b4fdd7

Please sign in to comment.