I have been experiencing problems with bitbucket and their post commit.
This isn't really answering your question, but suggesting another approach. Both bitbucket.org and github.com support ssh keys.
See "Set up SSH for Git"
It is important to setup ssh-agent (explained in that page), as without this you'll be asked to enter a pass phrase instead of username and password.