You don't really want to store any user's password unencrypted in the filesystem if you can avoid it. It depends a little how much you're relying on the portability of the code you have in git vs. what you can store on the local filesystem. I'd recommend using sudo with NOPASSWD with as restricted of a command as you can. You'd make a /etc/sudoers entry something like:
git ALL=(www) NOPASSWD: /usr/local/sbin/deploySite
deploySite has various checks in it to make sure the user is going into the correct directory and the
deploy.sh script doesn't have anything sketchy in it.
If you trust user git to use user www's account responsibly, you can use NOPASSWD:ALL. But you're basically allowing whomever has access to upload to git access to run any command they want as user www.
But to answer the original question
You can have sudo ask for the target user's password rather than the calling user. You'd put a sudoers entry like:
Then user git will have to type the password of user www when he runs
sudo -u www ....