Notes - GIT

Return to note list
git push with a pre-push hook exits with 141

Exit value 141 means git received SIGPIPE, that is to say the process tried to write to a pipe that was closed. This usually means that your pre-push hook took too long to run, and thus the connection to your upstream provider was closed. You can fix this by making ssh send keepalive messages to your upstream provider. For instance, for gitlab.com, you would add the following to ~/.ssh/config:

Host gitlab.com  
    ServerAliveInterval 60  
    ServerAliveCountMax 10  

Adjust ServerAliveCountMax to around the number of minutes your pre-push hook takes to run.