PHP exec() git fetch failing with return value 255 -


i have modified version of github project https://github.com/lkwdwrd/git-deploy [i modified reason json wasnt being parsed on server (mediatemple grid server) & added custom logging] script autodeploys github repos using git hooks.

the script working fine while stopped working.

i've isolated problem git fetch command. exact code i'm using:

exec( 'git fetch ' . $this->_remote . ' ' . $this->_branch, $fetch_output, $fetch_return_var );

the $fetch_output array blank , $fetch_return_var 255. believe 255 means -1, error git command.

however able execute command when ssh'd server , running same user exact same string being build 1st argument of exec() function.

so i'm lost.

  • is there effective difference between running commands manually via ssh , using exec()?
  • is there way can actual git fetch error being returned exec()?
  • could kind of server configuration has been changed host , should contact them for?

thanks in advance


update:

thanks @matthias huttar changed exec() proc_open() call allowed me see output of stderr [not sure why not logging thru exec() think because subprocess of git fetch]. output is:

error: cannot fork() git-remote-https: resource temporarily unavailable

so think there issue server environment. i'm still not certain.

if there error in git fetch output not written stdout stderr. exec give output of stdout , ignore stderr.

exec( 'git fetch ' . $this->_remote . ' ' . $this->_branch.' 2>&1', $fetch_output, $fetch_return_var ); 

will show error. suspicion git process invoke php runs different user (e.g. apache server's user) , therefore nit have access ssh key (or username/password). if case error msg "permission denied". solution o generate new default ssh key user , grant key access in github ("deploy key" how github calls this)


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -