11

I have set up one of my EC2 instances with git and using a post-receive hook I have it deploying to my server with this tutorial. This is the output from my console:

$ git push production master
git@example.com's password:
Counting objects: 26, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (19/19), 2.51 KiB, done.
Total 19 (delta 14), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
error: error in sideband demultiplexer
To git@184.169.147.123:halftown.git
   5d5e809..eb30e51  master -> master
error: failed to push some refs to 'git@example.com:git_application.git'

Please let me know if you need anything else to help me resolve this issue.

Jeff Thomas
  • 4,728
  • 11
  • 38
  • 57
  • possible duplicate of [Git responds with 'error in sideband demultiplexer'](http://stackoverflow.com/questions/4582849/git-responds-with-error-in-sideband-demultiplexer) – Amber Mar 06 '12 at 22:30
  • 1
    I originally thought it was a duplicate, however resetting the heads did not fix it. Mine is a problem I believe is getting the hook to read the STDIN. – Jeff Thomas Mar 06 '12 at 23:26

1 Answers1

18

I have figured out the problem that I was having. Apparently, you have to make sure you read everything from STDIN before completing the script.

This was my post-receive hook before:

#!/bin/sh
git checkout -f

This is what I added that solved the problem:

#!/bin/sh
while read oldrev newrev refname
do
:
done
git checkout -f
Jeff Thomas
  • 4,728
  • 11
  • 38
  • 57