我可以将全局 Git 配置文件 (~/.gitconfig) 的位置更改为某个自定义位置吗? 例如,到 ~/.config/git/.gitconfig?
最佳答案
来自 git config
, 你可以尝试设置 XDG_CONFIG_HOME
XDG_CONFIG_HOME/git/config
Second user-specific configuration file.
If$XDG_CONFIG_HOME
is not set or empty,$HOME/.config/git/config
will be used.
Any single-valued variable set in this file will be overwritten by whatever is in~/.gitconfig
. It is a good idea not to create this file if you sometimes use older versions of Git, as support for this file was added fairly recently.
它不会更改全局配置,但会提供一个替代位置。
关于git - 更改全局 Git 配置文件的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47741814/