unable to set GIT_WORK_TREE variable in a bare repository when using post_update hook

后端 未结 1 541
囚心锁ツ
囚心锁ツ 2020-12-10 22:48

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

相关标签:
1条回答
  • 2020-12-10 23:39

    EDIT: ok, so now I see your problem.

    This is the script you need:

    #!/bin/sh
    echo
    echo "**** Pushing data to Live Server.">>~/hi.txt
    echo
    GIT_WORK_TREE=/home/***/public_html/b1a git checkout -f
    

    I really don't know why nor how this works, but it does.

    I don't know either why you were redirecting the export output to those files - do you really need that?

    This script just check's out the current HEAD of the repository to the GIT_WORK_TREE directory. That's it. If you need anything else, please comment.


    I think you're not exporting GIT_WORK_TREE variable.

    Try changing those lines so you really export that variable instead of just setting it:

    #!/bin/sh
    echo
    echo "**** Pushing data to Live Server.">>~/hi.txt
    echo
    export GIT_WORK_TREE=/home/***/public_html/b1a
    export > ~/.file1.txt
    git checkout -f
    

    The first export sets GIT_WORK_TREE value'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...

    0 讨论(0)
提交回复
热议问题