Git - 添加本地配置文件
Git - add local config file
我想检查我对本地 GIT 配置文件所做的更改以及当我尝试此命令时:
git add .git/config --force
错误并显示以下消息:
warning: LF will be replaced by CRLF in .git/config.
The file will have its original line endings in your working directory
error: invalid path '.git/config'
error: unable to add '.git/config' to index
fatal: adding files failed
想知道这是否可行,或者这是否被认为是不好的做法。
注意:我想做的是检查整个团队需要使用的一些默认差异工具。如果这被认为是不好的做法,我该如何实现呢? (我可能希望标准化的其他设置:空格、crlf 的自动转换等)。
您应该改用 .gitattributes file。
您不能添加位于 .git/
下的文件
.git/config
还包含本地信息,比如远程跟踪分支列表,或者远程配置,分享这些意义不大。
足够接近:您可以在您的存储库中提交一个通用配置文件,并使用 include
指令设置每个克隆以包含此文件:
# relative path are relative to the .git/ directory :
git config include.path ../common_config
Link 到文档:includes and conditional includes
我想检查我对本地 GIT 配置文件所做的更改以及当我尝试此命令时:
git add .git/config --force
错误并显示以下消息:
warning: LF will be replaced by CRLF in .git/config.
The file will have its original line endings in your working directory
error: invalid path '.git/config'
error: unable to add '.git/config' to index
fatal: adding files failed
想知道这是否可行,或者这是否被认为是不好的做法。 注意:我想做的是检查整个团队需要使用的一些默认差异工具。如果这被认为是不好的做法,我该如何实现呢? (我可能希望标准化的其他设置:空格、crlf 的自动转换等)。
您应该改用 .gitattributes file。
您不能添加位于 .git/
下的文件
.git/config
还包含本地信息,比如远程跟踪分支列表,或者远程配置,分享这些意义不大。
足够接近:您可以在您的存储库中提交一个通用配置文件,并使用 include
指令设置每个克隆以包含此文件:
# relative path are relative to the .git/ directory :
git config include.path ../common_config
Link 到文档:includes and conditional includes