我想直接从git配置我的Symfony网站自动部署到我的ovh服务器(性能提供 - 通过SSH访问)。
我遵循了这些ovh说明:https://docs.ovh.com/fr/fr/web/hosting/24-days/day07/
在$ HOME / depot_git_beta / hooks
创建了一个post-receive文件#!/bin/bash
# Hook post-receive
# Force source bash profile to update PATH
source ~/.bash_profile
source ~/.bashrc
GIT_REPO=$HOME/depot_git_beta
DEPLOY_DIR=$HOME/beta
# Go to deploy directory to load ovhconfig
cd $DEPLOY_DIR
ovhConfig
cd -
while read prevsha1 newsha1 ref
do
if [[ $ref =~ .*/develop$ ]];
then
echo "Deploying develop branch to beta..."
git --work-tree=$DEPLOY_DIR --git-dir=$GIT_REPO checkout -f
cd $DEPLOY_DIR
# Install vendors
composer install --no-dev --no-interaction
echo "Vendors updated!"
# Update database
php bin/console doctrine:schema:update --force
echo "Database for beta environment updated!"
# Clear cache
php bin/console cache:clear --env=dev
php bin/console cache:clear --env=prod
echo "Cache cleared!"
else
echo "Ref: $ref isn't develop. Nothing to do on beta"
fi
done
添加远程存储库
git remote add ovh VOTRE_IDENTIFIANT@ftp.clusterXXX.hosting.ovh.net:depot_git_beta
但是当我git push ovh develop
它似乎确实有效时,git bash告诉它是最新的,但似乎没有发生在ovh服务器上。
知道出了什么问题或者我应该先看看哪里?
答案 0 :(得分:1)
问题基本上是因为我没有部署主分支,所以我必须在这一行中对其进行精确处理:
$ git --work-tree=... --git-dir=... checkout -f develop
请参阅此very helpful answer!
(感谢piarson帮助我找到解决方案!)