Home  >  Article  >  Backend Development  >  shell 脚本中git 命令不生效

shell 脚本中git 命令不生效

WBOY
WBOYOriginal
2016-06-06 20:32:561906browse

通过php exec函数执行一段shell脚本
然后脚本可以执行,但脚本里面有git 指令。git指令不生效。不知道啥原因

shell 指令如下:
shell 脚本中git 命令不生效

回复内容:

通过php exec函数执行一段shell脚本
然后脚本可以执行,但脚本里面有git 指令。git指令不生效。不知道啥原因

shell 指令如下:
shell 脚本中git 命令不生效

你的git repository 是在/srv/www/bfar-ng 这个目录下吗,如果不是,没办法执行git的。
另外git在不能执行时会有信息输出到stdout的, 你也可以看下执行shell产生的输出来分析下原因,可以给exec在第二个参数位置那传递一个数组,shell产生的输出都会存到这个数组里面去。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn