git - 更改全局 Git 配置文件的位置

标签 git

我可以将全局 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/

相关文章:

git - 此存储库已针对 Git LFS 配置,但在您的路径中未找到 'git-lfs'

git - 使用 GitFlow 构建推广究竟是如何工作的?

r - 从github存储库安装开发版本R包时如何指定lib目录

android - repo 同步无法初始化 CM13 工作树

git - 在 git 上删除远程分支时被拒绝

git - 使用 git 将我的 node.js 应用程序部署到我的生产服务器

git - 允许代理转发使用 Cmder (ConEmu)

svn - git-svn 和本地分支

git - 'git branch -a' 仍然在远程仓库中显示已删除的远程分支?

git - 如何在存储库历史记录中的每个 git 提交中查找字数?