nobeh
nobeh

Reputation: 10039

Git post-receive-email: Unknown type of (commit)

I'm having an issue with Git's post-receive-email hook script. Here is what I did:

  1. On my server, I initialized a bare repository using: git --bare init myrepo.git. My server's Git config file says core.bare = true
  2. Did the setup using the guides for Git email for post receive
  3. On my client, clones the repository using git clone URL. On my client, Git config is core.bare = false.
  4. Did some work, added the new files, committed to the local Git
  5. Pushed the changes to the remote repository using: git push origin master which issues the generated ref-ids for the commits done
  6. But I do not receive emails; so tried to run the post-receive hook script on the server in hooks directory with ./post-receive <oldrev> <newrev> refs/heads/master

The following error is constantly returned:

Unknown type of update to c9c047af (commit)
no email generated

Any clues what could be wrong?

Upvotes: 2

Views: 577

Answers (1)

nobeh
nobeh

Reputation: 10039

Although I used a distribution post-receive-email script, I found a strange bug in the script. Towards the end of post-receive-email in my version said:

prep_for_email $2 $3 $1 && PAGER= generate_email

which should be

prep_for_email $1 $2 $3 && PAGER= generate_email

The change resolved my manual call to post-receive <oldrev> <newrev> <refname>. I hope this helps others that may face it.

Upvotes: 1

Related Questions