【问题标题】:PHP: shell_exec git pull pass passphrase [duplicate]PHP:shell_exec git pull pass passphrase [重复]
【发布时间】:2017-05-24 17:04:24
【问题描述】:

我有脚本 PHP 跟随:

shell_exec('D: && cd D:\Xampp\htdocs\demo_gitlab && git pull');

(用 PHP 更新 gitlab) 当我使用命令窗口进行测试时,结果:

C:\Users\nknha>D: && cd D:\Xampp\htdocs\demo_gitlab && git pull
Enter passphrase for key '/c/Users/nknha/.ssh/hsdichvu': 
remote: Counting objects: 3, done. 
remote: Compressing objects: 100% (3/3), done. 
remote: Total 3 (delta 2), reused 1 (delta 0) 
Unpacking objects: 100% (3/3), done. 
From gitlab.com:huesoft/diet-tru-sau
    7e940be..22886d0  master     -> origin/master Updating 7e940be..22886d0 
Fast-forward
  README.md | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

那么如何在运行命令shell_exec

时输入密码

【问题讨论】:

    标签: php git gitlab shell-exec


    【解决方案1】:

    你不能因为它是外部程序的一部分。
    你只能将它作为参数传递。我建议创建一个单独的 shell 脚本并使用shell_exec() 运行它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-17
      • 2013-08-21
      • 2014-12-01
      • 2020-03-25
      • 1970-01-01
      • 2021-11-17
      • 2013-01-30
      相关资源
      最近更新 更多