通过PHP exec IIS进行git pull [英] git pull via PHP exec IIS
问题描述
exec('call git pull',$ output);
这个过程会暂停,并且会使用IIS。
exec('call git status',$ output); //正常工作
以下是我所做的:
mysite / .git /
和 Program Files / git / bin
和 cmd.exe
2> NUL
和 2>& 1
显然,有一个权限问题,其中 exec
调用 cmd.exe
然后调用 git.exe
,然后调用 sh.exe
连接到github,然后github使用 git-pull
,可能还有 git-send-pack
和上帝知道些什么。
我猜'sh.exe'确定当前用户是IUSR,并且找不到要认证的RSA密钥。
如果我能弄清楚如何 ssh-keygen
IUSR账户,我会试试这个。 p>
如果我能弄清楚 exec
git bash而不是git(通过 cmd.exe
以下是最简单的问题:
$ b
如何从PHP的 exec
方法从我的github仓库中取出?
这个问题当然似乎与SSH,但我完全在尝试的一切结束。
帮助!
我今天遇到同样的问题, Process Monitor看看发生了什么,并发现由于某些原因 sh.exe
在 C:\Windows\SysWOW64\\中查找了键\\config\systemprofile\.ssh
。因此,我将 C:\ Users \Administrator\.ssh
中的所有内容复制到该文件夹中,并且完美地工作。
Easily the most difficult problem to diagnose that I have EVER experienced. I seem to be unable to call:
exec('call git pull', $output);
The process hangs and tends to take IIS with it.
exec('call git status', $output); //works fine
Here's what I've done:
- Generated RSA key added to github (passcode is blank)
- Everyone has permission on
mysite/.git/
, andProgram Files/git/bin
andcmd.exe
- Tried the ssl cert fix mentioned in other posts with 'slash' issue
- Tried using https:// instead of SSH
- Tried piping to stderr
2>NUL
and2>&1
Clearly, there's a permissions issue where exec
calls cmd.exe
which in turn calls git.exe
, which in turn calls sh.exe
to connect to github, which in turn makes use of git-pull
and possibly git-send-pack
and GOD KNOWS what else.
I'm guessing 'sh.exe' determines the current user is IUSR and cannot find the RSA key to authenticate with.
If I could figure out how to ssh-keygen
the IUSR account, I would have tried that.
If I could figure out how to exec
git bash instead of git (via cmd.exe
) I would have tried that.
Here's the question in it's simplest form:
How do I pull from my github repo via PHP's exec
method?
The problem certainly seems to be with SSH, but I'm totally at the end of everything to try.
Help!
I faced the same problem today and used Process Monitor to see what was going on and found that for some reasons sh.exe
looked for the keys in C:\Windows\SysWOW64\config\systemprofile\.ssh
. So I copied everything in C:\Users\Administrator\.ssh
to that folder and it worked perfectly.
这篇关于通过PHP exec IIS进行git pull的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!