diff options
Diffstat (limited to 'plumbing/transport/ssh/common.go')
-rw-r--r-- | plumbing/transport/ssh/common.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plumbing/transport/ssh/common.go b/plumbing/transport/ssh/common.go index c05ded9..46e7913 100644 --- a/plumbing/transport/ssh/common.go +++ b/plumbing/transport/ssh/common.go @@ -6,6 +6,7 @@ import ( "fmt" "reflect" "strconv" + "strings" "github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git/v5/plumbing/transport/internal/common" @@ -90,8 +91,14 @@ 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() + //XXX: in go1.16+ we can use errors.Is(err, net.ErrClosed) + if err != nil && strings.HasSuffix(err.Error(), "use of closed network connection") { + return nil + } + + return err } // connect connects to the SSH server, unless a AuthMethod was set with |