I encountered this issue, scp'ing on port 22 from a linux machine to a linux machine trough 2 NAT's.
Since I had no control over the Windows Machines or the NAT boxes, only the 2 linux machines, my solution was to switch the ssh server from port 22 to 2222 and things got working.
Same issues, scping from windows machine to the linux box worked, scping from the linux machine to my machine worked, but sending data from my machine to the linux server ended in the server (Or the firewall on a NAT box in between) sending TCP RST packets to my server.
symptoms with scp:
debug2: channel 0: written 31 to efd 7
rapport.pdf 0% 0 0.0KB/s --:-- ETAdebug3: send packet: type 1
packet_write_wait: Connection to 192.168.1.2 port 22: Broken pipe
lost connection
symptoms with git over ssh:
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Counting objects: 176, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (90/90), done.
debug2: channel 0: rcvd adjust 98457
debug3: send packet: type 176)
packet_write_wait: Connection to 192.168.1.2 port 22: Broken pipe
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
some further digging got me to https://serverfault.com/questions/411629/tcp-connection-reset-in-linuxstrange-packet-loss-but-not-on-windows
Which had the a solution if you only have control of your local Linux Machine:
there is a broken firewall along the path that is filtering all IP packets that use TCP Timestamp option.
So to keep things working on port 22 I ran this on my machine:
echo 0 | sudo tee /proc/sys/net/ipv4/tcp_timestamps