<legend id='BaIYm'><style id='BaIYm'><dir id='BaIYm'><q id='BaIYm'></q></dir></style></legend>
  • <tfoot id='BaIYm'></tfoot>
    • <bdo id='BaIYm'></bdo><ul id='BaIYm'></ul>
    <i id='BaIYm'><tr id='BaIYm'><dt id='BaIYm'><q id='BaIYm'><span id='BaIYm'><b id='BaIYm'><form id='BaIYm'><ins id='BaIYm'></ins><ul id='BaIYm'></ul><sub id='BaIYm'></sub></form><legend id='BaIYm'></legend><bdo id='BaIYm'><pre id='BaIYm'><center id='BaIYm'></center></pre></bdo></b><th id='BaIYm'></th></span></q></dt></tr></i><div id='BaIYm'><tfoot id='BaIYm'></tfoot><dl id='BaIYm'><fieldset id='BaIYm'></fieldset></dl></div>

        <small id='BaIYm'></small><noframes id='BaIYm'>

        从 php 脚本运行 git pull

        时间:2023-10-12
        <legend id='vodzn'><style id='vodzn'><dir id='vodzn'><q id='vodzn'></q></dir></style></legend>

                  <tbody id='vodzn'></tbody>
                • <bdo id='vodzn'></bdo><ul id='vodzn'></ul>

                  <small id='vodzn'></small><noframes id='vodzn'>

                  <i id='vodzn'><tr id='vodzn'><dt id='vodzn'><q id='vodzn'><span id='vodzn'><b id='vodzn'><form id='vodzn'><ins id='vodzn'></ins><ul id='vodzn'></ul><sub id='vodzn'></sub></form><legend id='vodzn'></legend><bdo id='vodzn'><pre id='vodzn'><center id='vodzn'></center></pre></bdo></b><th id='vodzn'></th></span></q></dt></tr></i><div id='vodzn'><tfoot id='vodzn'></tfoot><dl id='vodzn'><fieldset id='vodzn'></fieldset></dl></div>
                • <tfoot id='vodzn'></tfoot>
                • 本文介绍了从 php 脚本运行 git pull的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试 完美的工作流程,使用 Git、GitHub 和 SSH,除了从 php 运行命令 git pull 外,我已经设置好了一切.

                  I was trying the Perfect Workflow, with Git, GitHub, and SSH, and i have everything set up, except running the command git pull from php.

                  当我运行 exec('git pull') 我得到:

                  无法创建目录/.ssh".主机密钥验证失败.致命:远端意外挂断

                  Could not create directory '/.ssh'. Host key verification failed. fatal: The remote end hung up unexpectedly

                  如果我在终端(以 root 用户身份)运行它,它工作得很好,但我需要这个钩子从接收后 URL (Github) 工作.

                  If i run it in the terminal (as root) it works just fine, but i need this hook to work from the Post-Receive URL (Github).

                  如果我执行 exec('whoami') 我得到 apache.

                  If i do exec('whoami') i get apache.

                  它是来自带有 CentOS 的 mediatemple 的 (dv).

                  It's a (dv) from mediatemple with CentOS.

                  推荐答案

                  如果您希望 apache(用户)能够从 git 中拉取数据,您必须为apache,然后将其添加到 github 上的只读键中.

                  If you want apache (the user) to be able to pull from git, you'll have to create an ssh key for apache, then add that to the read only keys on github.

                  流程是这样的(根据您的需求进行调整)

                  The flow is something like this (tweak to your needs)

                  usermod -s /bin/bash apache
                  su apache
                  cd ~
                  ssh-keygen # work through the keygen dance (added a dash)
                  

                  上传(这里的波浪号指的是 apache 的 homedir)~/.ssh/id_rsa.pub 到 github 并授予 apache 访问它需要从中提取的任何存储库的权限.

                  Upload (tilde here refers to apache's homedir) ~/.ssh/id_rsa.pub to github and give apache access to whichever repos it needs to pull from.

                  然后您可以通过再次su到apache并运行git pull

                  Then you can test on the server by again su'ing to apache and running the git pull

                  su apache
                  cd ~/working-copy
                  git clone my-project
                  

                  一旦成功,您应该能够通过 PHP 运行 git pull.

                  Once that's working you should be able to run a git pull through PHP.

                  这篇关于从 php 脚本运行 git pull的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从 php exec() 运行 libreoffice 下一篇:即使具有完全打开的权限,PHP fopen() 也会对文件失败

                  相关文章

                  • <bdo id='2uDKw'></bdo><ul id='2uDKw'></ul>

                    <legend id='2uDKw'><style id='2uDKw'><dir id='2uDKw'><q id='2uDKw'></q></dir></style></legend>
                  1. <i id='2uDKw'><tr id='2uDKw'><dt id='2uDKw'><q id='2uDKw'><span id='2uDKw'><b id='2uDKw'><form id='2uDKw'><ins id='2uDKw'></ins><ul id='2uDKw'></ul><sub id='2uDKw'></sub></form><legend id='2uDKw'></legend><bdo id='2uDKw'><pre id='2uDKw'><center id='2uDKw'></center></pre></bdo></b><th id='2uDKw'></th></span></q></dt></tr></i><div id='2uDKw'><tfoot id='2uDKw'></tfoot><dl id='2uDKw'><fieldset id='2uDKw'></fieldset></dl></div>
                    <tfoot id='2uDKw'></tfoot>

                      <small id='2uDKw'></small><noframes id='2uDKw'>