简体   繁体   中英

Fatal error 'No such file or directory' when attemping to deploy via Git

I'm trying to setup deployment of a website via Git but am running into a problem with the post-receive hook. This is on a Windows server. The output of the push is as follows:

git -c diff.mnemonicprefix=false -c core.quotepath=false commit -q -F C:\Users\Adam\AppData\Local\Temp\ib1plrg0.ejf

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream test master:master
Pushing to ssh://cyg_server@192.168.1.109/~/website

Branch master set up to track remote branch master from test.

remote: Starting checkout[K
remote: fatal: Could not switch to '/c/inetpub/': No such file or directory[K
remote: Finished checkout[K
To ssh://cyg_server@192.168.1.109/~/website
   4da534b..8e32d89  master -> master
updating local tracking ref 'refs/remotes/test/master'

The Post-Receive hook is setup as follows:

#!/bin/sh
echo "Starting checkout"
GIT_WORK_TREE=/c/inetpub/wwwroot git checkout -f
echo "Finished checkout"

For some reason when pushing, it looks like I can't change to the wwwroot directory. It's definitely there, and that line itself works fine when running it manually from within Git Bash so I'm not sure what the problem is.

For reference I've installed OpenSSH via Cygwin and Git 1.9.4. I'm connecting via SSH. The home directory for connecting via SSH is C:\\Repositories and in there I have a folder called website which is initialised as a bare Git repository.

I've been searching for help on this error for hours now and haven't come up with any resolution yet. Can anyone help?

Thanks.

Just in case it helps anyone else I have fixed this. The way the path was constructed was the problem and so the working post-receive hook is as follows:

#!/bin/sh
echo "Starting checkout"
GIT_WORK_TREE='c:/inetpub/wwwroot' git checkout -f
echo "Finished checkout"

Note the quotes around the path and the more windows like construction.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM