通过PHP exec IIS进行git pull [英] git pull via PHP exec IIS

查看:137
本文介绍了通过PHP exec IIS进行git pull的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

容易成为我经历过的最难诊断的问题。我似乎无法调用:

  exec('call git pull',$ output); 

这个过程会暂停,并且会使用IIS。

  exec('call git status',$ output); //正常工作

以下是我所做的:


  • 生成的RSA密钥添加到github(密码为空)

  • 每个人都有 mysite / .git / Program Files / git / bin cmd.exe

  • 尝试使用https://而不是SSH进行尝试

  • 使用'slash'问题尝试了其他帖子中提到的ssl cert修复程序
  • 尝试将管道连接到stderr 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/, and Program Files/git/bin and cmd.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 and 2>&1

Clearly, there's a permissions issue where exec calls cmd.exe which in turn calls git.exe, which in turn calls sh.exeto connect to github, which in turn makes use of git-pull and possibly git-send-packand 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆