首页 > 解决方案 > 设置自定义 git 配置文件位置

问题描述

我正在使用 Linux (Tcsh) 并且我正在尝试设置一个自定义文件,该文件不会位于将通过以下命令访问的主目录中:

git config --global user.name <user-name>

它在我无法修改的脚本中。

我正在尝试在不更改环境变量的情况下做到这一点$HOME。换句话说,类似:

touch mygitconfigfile
./my-script-i-cant-edit
cat mygitconfigfile #has user.name config line

可能吗?

标签: git

解决方案


执行

git config --edit --global

并添加行

[include]
    path = ~/someotherfile

推荐阅读