I am trying to set git up with http://danielmiessler.com/study/git/#website to manage my site. I am working using the git gui in win7
I have gotten to the last step in the instructions: git push website
After pushing to the website, I was able to confirm that the object directory in bare directory ~/website.git is updated.
my hook is called ‘post_update’ it has the following contents
#!/bin/sh
echo
echo "**** Pushing data to Live Server.">>~/hi.txt
echo
export > ~.file1.txt
GIT_WORK_TREE=/home/***/public_html/b1a
export >> ~.file1.txt
git checkout -f
when I go to /public_html/b1a, it is an empty directory. Please note, I have changed the hooks directory and b1a to 777.
I can confirm that the post_update hook is firing, because I printing the environmental variables to file1.txt (as you can see above). In the file I see:
GIT_DIR="."
but GIT_WORK_TREE is not seen. without the ability to set this I am stuck.
I would appreciate any help,
Thanks in advance,
Bill
EDIT: ok, so now I see your problem.
This is the script you need:
I really don’t know why nor how this works, but it does.
I don’t know either why you were redirecting the
exportoutput to those files – do you really need that?This script just check’s out the current
HEADof the repository to theGIT_WORK_TREEdirectory. That’s it. If you need anything else, please comment.I think you’re not exporting
GIT_WORK_TREEvariable.Try changing those lines so you really export that variable instead of just setting it:
The first
exportsetsGIT_WORK_TREEvalue’s and marks it for export, the second one outputs all current exported variables to the file.I’m running this on Linux, but I hope it’s the same on git-bash…