所以我在我的服务器上设置了一个 post-checkout hook,它将运行 Composer
#!/bin/sh
# Composer Git Checkout Hook
PROJECT_NAME=example.com
cd /home/www/$PROJECT_NAME/htdocs
unset GIT_DIR
# Process composer.json if one exists.
if [ -f composer.json ]
then
echo "Processing Composer"
# Run the composer install
composer.phar install
fi
部署时,它可以工作。但是,由于是新服务器并且我忘记启用 cURL 模块,因此安装失败,但接受了推送。
$ git push deploy master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 348 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Processing Composer
remote: Loading composer repositories with package information
remote: Installing dependencies from lock file
remote: Your requirements could not be resolved to an installable set of packages.
remote:
remote: Problem 1
remote: - Installation request for facebook/php-sdk dev-master -> satisfiable by facebook/php-sdk dev-master.
remote: - facebook/php-sdk dev-master requires ext-curl * -> the requested PHP extension curl is missing from your system.
remote:
To ssh://adam@my-server.net/home/www/example.com/git
0fa8a61..afa63ae master -> master
如何获取 Composer 安装和退出的状态,以便远程存储库拒绝推送?