我们正在混合环境(OSX、Linux、Windows)中设置 git 1.8
,并且有些文件名使用非英文字符。我读到 core.precomposeunicode
需要在 OSX 系统上设置为 true
。
我们不关心向后兼容性。我们关心的是让开发人员的事情变得简单。我们宁愿不必解释 git
配置。
那么:全局设置该标志是否安全(在中央 git 服务器中)?这会强制我们需要的一致性吗?有理由不这样做吗?
最佳答案
不,那行不通。 分布式版本控制系统中没有中央 git 服务器这样的东西 - 至少在技术意义上是这样。
每个开发人员都有自己的存储库,他可以在其中 checkin 更改。当这些更改被推送到您声明为中心的存储库时,数据不会被重新处理。
您必须在每个本地存储库上设置该配置。
不幸的是,.gitattributes 也没有其他选择。
然后由开发人员克隆的某个存储库的本地选项也不是一个选项。下面的简单实验表明了这一点:
d:\Temp\Origin>git init
Initialized empty Git repository in d:/Temp/Origin/.git/
d:\Temp\Origin>git config --local --add core.autocrlf input
d:\Temp\Origin>git config --local --list
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
core.autocrlf=input
d:\Temp\Origin>cd ..
d:\Temp>git clone d:\Temp\Origin Developer
Cloning into 'Developer'...
warning: You appear to have cloned an empty repository.
done.
d:\Temp>cd Developer
d:\Temp\Developer>git config --local --list
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=d:\Temp\Origin
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
请注意 Origin
中对 git config --local --list
的调用如何列出 core.autocrlf=input
以及Developer
没有,尽管我们只是从 Origin
克隆了 Developer
。
这表明存储库本地配置值未被克隆。
关于git - 全局设置 git 的 core.precomposeunicode = true 安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15231589/