接收后,请求 php 脚本,拉取 git 存储库
我的网络服务器上有一个 PHP 脚本 git.php,只有几行,其中一行使用 shell_exec() 运行
'git pull ssh://[email protected]/repo.git'
(请注意,您无法推送到网络服务器,这已被禁用并且无法启用。) 如果您访问 example.com/git.php,这一切都可以正常工作。脚本运行并且存储库得到更新。 (存储库位于另一个不相关的服务器上)
我想做的是使用我的 post-receive 挂钩从我的 git 服务器更新我的 web 服务器上的 git 存储库。我正在使用 ssh 进行连接,因此钩子应该(并且确实有效,我已经测试过)有效,并且我非常确定不存在权限问题。
我的问题是如何编写“接收后”脚本?
我尝试了一些方法,但没有成功,我的脚本目前只有 1 行长,看起来像这样,
curl -d "action=post-receive&log=1" http://example.com/git.php
但这什么也没做。 :(
有谁可以帮助我吗?或者建议我可以做得更好吗? 提前致谢。
I have a PHP script git.php on my web-server with only a few lines, one of the lines uses shell_exec() to run a
'git pull ssh://[email protected]/repo.git'
(Please note, you cannot push to the webserver, this is disabled and cannot be enabled. )
This all works fine if you go to example.com/git.php. The script runs and the repo gets updated. (the repo is on another unrelated server)
What I am trying to do is use my post-receive hook to update my git repo on my web server from my git server. I am using ssh to connect, so hooks should (and do work, i have tested that) work, and am pretty sure there are no permissions problems.
My question is how do I write the 'post-receive' script?
I have tried a few things with no luck, my script is currently 1 line long and looks something like this
curl -d "action=post-receive&log=1" http://example.com/git.php
but this does nothing. :(
Is there anyone who can help me? Or suggest anything that I could do better?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论