I've setup a Git server according to this page.
I've also incorporated a post-receive
hook according to this page.
I'm using GitHub for Windows to communicate between my local machine and the git repo.
My issue is that the post-receive
hook utilizes a variable found in git config user.asana-key. I've set that variable on my local machine. However, when I commit to the server repository, that value is empty.
I'm wondering if there's something specific I should be doing to send this variable along with the git commit so that the hook can read it?
And if there's someway to automate this to be sent with every single commit?
EDIT:
I have since learned that these config variables are never sent to the server with a commit normally. So my question at this point becomes is there a way to send these variables, or is there way inside the post-receive hook to set the key based on the user.email attached to the commit?
I didn't receive an answer on this, so I kept looking around and just posting this for others in case someone runs across this.
I discovered that you can't access the user.name and user.email sent with a commit in the git hooks. So I had to go another way. I installed gitolite on the server with the git repository, following their idiots guide located here. I combined that with their instructions on how to do it with an existing repo, located here. And then followed their guide for using hooks, which explains what variables are passed to hooks, located here. Specifically I used the variable GL_USER.
Then inside the local config for the git repo I added:
[asana]
gitolite-user-name = asana-api-key
Where gitolite-user-name is the username associated with each gitolite user you have, and asana-api-key is the api key for that user.
Then in my post-receive hook I added:
apikey=$(git config asana.$GL_USER)
Which grabs the corresponding api key for the user that did the commit. This allows each user to comment on their own commits using their account in Asana.