【问题标题】:Once I compile and install chosen version of git, how do I force the shared hosting to use my version?编译并安装所选版本的 git 后,如何强制共享主机使用我的版本?
【发布时间】:2017-04-23 08:42:18
【问题描述】:

Compiler error - msgfmt command not found when compiling git on a shared hosting继续

在设法制作和安装最新的 git 后,如何强制 cpanel 共享主机使用我的版本?

  • 我的版本在/home/<ME>/git/git-2.9.0

  • 我用

    编译了make脚本
    make -i prefix=/home/<ME>/bin all
    
  • echo $PATH; 在变量中列出该路径。此外,路径附加到当前 PATH。

现在,我希望服务器响应

/home/<ME>/bin/git

当我运行which git

【问题讨论】:

  • 运行 echo $PATH 并告诉我们它说了什么。
  • @JohnZwinck - 就像我说的,路径似乎已经附加好了---回显路径变量的输出是home/&lt;me&gt;/perl5/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/cpanel/composer/bin:/opt/puppetlabs/bin:/opt/dell/srvadmin/bin:/home/&lt;me&gt;/bin
  • PATH 查找是递归的吗? - 主机是否在任何/所有嵌套子目录中查找二进制文件?
  • 它不是递归的。但更重要的是,您将首选路径放在了 END 位置,而它应该位于 $PATH 变量的 START 位置。就目前而言,您的系统只会在您的目录中查找作为最后的手段,毕竟它可能会找到git 的所有其他目录。

标签: linux git github cpanel shared-hosting


【解决方案1】:

所以,安装后,二进制文件存储在

/home/&lt;ME&gt;/bin/bin/

因为,我编译用

make -i prefix=/home/&lt;ME&gt;/bin all

问题

PATH 查找不是递归的。

解决方案

  • (可选)将所有 git 二进制文件移动到 /home/&lt;me&gt;/bin/ 下的子目录中

  • 只需添加/home/&lt;ME&gt;/bin/的所有子目录

到当前路径。里面.~/.bash_profile

然后做

source ~/.bash_profile

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-24
    • 1970-01-01
    • 2013-02-23
    • 2015-04-14
    相关资源
    最近更新 更多