I am running an XAMPP server on my Windows Server 2008 R2. I am running Git 64-bit version 2.16.1.windows.1 I would like to use post-receivehook to update my site after I do pa push from my client.
I created an empty project MyProject.giton the server and cloned it to MyProject.
My hook:
echo "Hook got triggered.." > hooks.txt
exec powershell.exe -NoProfile -ExecutionPolicy Bypass -File ".\hooks\post-receive.ps1"
Powershell script:
cd "C:/xampp/htdocs/webapp/myProject/"
git pull origin master
exec git-update-server-info
I was looking for similar questions without any problems to solve the problem.
If I run the script manually in powershell, it works fine. Based on my log, the hook even fires.
Git in Apache looks like it is configured correctly, because I can easily delete to a remote computer, and if I click on the server in a folder MyProject, the files that I get from the repo are correct.
?
EDIT:
:
echo "Hook got triggered.."
exec powershell.exe -NoProfile -ExecutionPolicy Bypass -File ".\hooks\post-receive.ps1"
powershell script :
cd "C:/xampp/htdocs/webapp/myProject/"
unset GIT_DIR
git pull origin master
exec git-update-server-info
, :
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 296 bytes | 296.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To http://git.mysite.com/myProject.git
999aeb1..cf0df6f master -> master
"Hook goteded..".
EDIT2:
:
echo "Hook got triggered.."
cd "C:/xampp/htdocs/webapp/drajv-tecaj/"
unset GIT_DIR
git pull origin master
script , usin bash. script - .
EDIT3
, :
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/webapp"
ServerName git.mysite.com
<Directory "C:/xampp/htdocs/webapp">
Options +ExecCGI +Indexes +FollowSymLinks
Require all granted
</Directory>
<Directory "C:/Program Files/Git/mingw64/libexec/git-core/">
Require all granted
</Directory>
SetEnv GIT_PROJECT_ROOT C:/xampp/htdocs/webapp
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git "C:/Program Files/Git/mingw64/libexec/git-core/git-http-backend.exe/"
ScriptAliasMatch \
"(?x)^/(.*/(HEAD | \
info/refs | \
objects/(info/[Apache Git server on Windows^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
git-(upload|receive)-pack))$" \
"C:/Program Files/Git/mingw64/libexec/git-core/git-http-backend.exe/$1"
</VirtualHost>