I'm trying using Git hook to deploy mt project in FTP.
By the way, I use 'CYGWIN' to build.
Here's my environment and settings.
FTP in remote
C:\\cygwin64\\test_ftp\\
Cygwin in remote
C:\\cygwin64\\
remote's root
C:\\cygwin64\\home\\Administrator\\
git/hooks/post-receive
#!/bin/sh
DEPLOY_DIR=~/../../test_ftp
echo "Start deploying..."
GIT_WORK_TREE=$DEPLOY_DIR git checkout -f
echo "Deployment is completed."
It works fine.
"git push" will trigger "post-receive" and deploy files in "C:\\cygwin64\\test_ftp\\".
.
Now I want to change the path of "test_ftp" to "C:\\test_ftp\\",
I try to set "DEPLOY_DIR=~/../../../test_ftp" and run "git push".
Error occurs in deploy task:
remote: fatal: This operation must be run in a work tree
Is there any way to set GIT_WORK_TREE's path out of cygwin??
I found the answer later.
Replace "/home/Administrator" to "/cygdrive/c".
Set "StrictModes no"
Set "AuthorizedKeysFile /path/to/your/authorized_keys"
It works!!
Now I can login with key, triggered "post-receive" as usual and deploy files in "C:\\test_ftp".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.