我正在使用Linux(Tcsh),并且试图设置一个自定义文件,该文件将不在主目录中,该目录可通过以下命令进行访问:
git config --global user.name <user-name>
它在我无法修改的脚本中。
我正在尝试不更改环境变量$HOME
的情况。换句话说,类似:
touch mygitconfigfile
./my-script-i-cant-edit
cat mygitconfigfile #has user.name config line
有可能吗?
答案 0 :(得分:1)
如果您希望git config
使用与例如~/.gitconfig
(带有--global
),请使用--file
标志。
git config --file=/path/to/my-git-config-file user.name Robert
请考虑man git-config
。
答案 1 :(得分:1)
执行
git config --edit --global
并添加行
[include]
path = ~/someotherfile