I'm trying to execute multiple git commands with PHP, exec and a batch file.
When I execute the bat file from my cmd windows, it runs perfectly. But for some reason, when I call the bat file with exec (in PHP) it only executes the until call git add -A
. Commit commando doesn't get executed. When I execute it manually(the commit command) and then run the script again, the files get pushed to the repo... The problem seems to be that the script doens't want to commit the files if it gets executed via exec in PHP.
This is my php:
exec('C:\wamp\www\git.bat "C:/wamp/www/project" "project"');
And this is my bat file:
@echo off
set drupal_root=%1
set repo_name=%~2
pushd %drupal_root%
call git init
call git remote add origin https://repo-url/%repo_name%.git
call git add -A
call git commit -m "Initial commit"
call git push origin master
Anyone has a clue what the reason could be?