首页 > 解决方案 > 是否可以通过 gitconfig 或类似方法向 Git 添加其他自定义路径以搜索脚本和命令?

问题描述

我正在尝试设置我的便携式 Git 以在特定文件夹中搜索其他脚本。

考虑这个示例目录树结构

-- my-portable-git
│
├───git-scripts
│       git-myscript
│       ⋮       # some more scripts
└───portable-git
        ⋮       # rest of files for portable git

由于我无法编辑我的PATHenv 变量$reasons,是否可以通过.gitconfig或通过其他方式添加其他路径git以在调用脚本/命令/等时使用?

参考上面的例子:是否可以说gitoi git,请查看文件夹../git-scripts/以获取更多命令!” 不编辑PATH环境?

标签: git

解决方案


是的。设置GIT_EXEC_PATH环境变量。

请参阅https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables


推荐阅读