I’m trying to git pull from a PHP file, but it seems like the config isn’t being used.
git config --global user.name and git config --global user.email are set and git pull works from the command line.
Now when I try to execute this script:
<?php
header('Content-type: text/plain');
system('git pull 2>&1');
echo "\nCompleted!";
I get the following output:
* Please tell me who you are.
Run
git config –global user.email “you@example.com” git config
–global user.name “Your Name”to set your account’s default identity. Omit –global to set the
identity only in this repository.fatal: empty ident not allowed
Completed!
Is it maybe because the git config is user specfic and PHP is ran from another user?
Just use the
-cflag on git itself:So something like:
should get you there. Add whatever arguments you need. If you want to specify a particular file, then either add the relevant configuration options to the user executing the script, or hack around it by exporting a different
HOMEenv variable first.