https://github.com/ezyang/git-ftp ( 可搭配hook,只傳新檔案和移除舊檔案 )
https://github.com/git-ftp/git-ftp ( 傳tracked的檔案 )
https://github.com/git-ftp/git-ftp
安裝:
# apt-get install git-ftp
使用(在 client repository):
$ git ftp init -u username -p password - ftp://your.ftp.domain/htdocs/ #第一次要用init
or
$ git ftp push -u username -p password - ftp://your.ftp.domain/htdocs/
https://github.com/ezyang/git-ftp ( 搭配hooks的 post-receive )
安裝:
# apt-get install python-setuptools ( 如果沒有easy_install,就先裝這個 )
# easy_install gitpython
在remote repository上根目錄建立 ftpdata ( 與config, HEAD同一層 ):
[master] username=ftp_username password=ftp_password hostname=your.ftp.domain remotepath=/htdocs #你的ftp上傳路徑 ssl=no #如果ftp 不支援https ,要改no
在hooks下建立 post-receive(權限775,直接複製github上的內容):
#!/bin/bash
# You may install this post-receive hook in your remote git repository
# to have automatic file upload when pushing to the repository.
while read OLD_COMMIT NEW_COMMIT REFNAME; do
BRANCH=${REFNAME#refs/heads/}
if [[ `grep "^\[$BRANCH\]$" ftpdata` ]]; then
echo "Uploading $BRANCH..."
$(dirname $(readlink -f "$0"))/git-ftp.py -b "$BRANCH" -c "$NEW_COMMIT" || exit $?
fi
done
true
在hooks下建立 git-ftp.py(權限775,直接複製github上的內容):
略
然後在client repository,git push後 就會更新程式到ftp上去
參考資料:
http://stackoverflow.com/questions/2950107/git-push-into-production-ftp
沒有留言:
張貼留言