1

I have the script PHP follow:

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

(Update gitlab with PHP) When i test with the command window, then result:

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(-)

So how can enter the passphrase when running command shell_exec

KhacNha
  • 317
  • 3
  • 13

1 Answers1

0

You can not as it is a part of the external program.
You can only pass it as an argument. I would suggest to create a separate shell script and run it with shell_exec().

malutki5200
  • 1,092
  • 7
  • 15