【发布时间】:2011-02-28 14:26:22
【问题描述】:
我在一个 git 存储库上工作,我们在其中建立了一个 php 社区,但我需要在某个地方展示它,所以我正在寻找一种方法来在我推送到存储库时自动将我的文件上传到远程 http 服务器。
谢谢/维克多
【问题讨论】:
标签: php git automation github httpserver
我在一个 git 存储库上工作,我们在其中建立了一个 php 社区,但我需要在某个地方展示它,所以我正在寻找一种方法来在我推送到存储库时自动将我的文件上传到远程 http 服务器。
谢谢/维克多
【问题讨论】:
标签: php git automation github httpserver
【讨论】:
如果第二台服务器上没有单独的 git repo,我会从存档中导出文件:
git checkout-index -a -f --prefix=/target/path/
然后使用sftp与远程服务器同步:
#!/bin/bash
HOST="ftp.example.com"
USER="user"
PASS="pass"
LCD="/var/www/yourdir"
RCD="/www/"
lftp -c "
#debug;
open ftp://$USER:$PASS@$HOST;
lcd $LCD;
cd $RCD;
mirror --only-newer \
--reverse \
--verbose \
--exclude-glob somepattern ";
您可以将此过程自动化为构建脚本(例如 Phing), 我们的绑定作为提交后的 git 钩子,就像之前提到的那样。
【讨论】: