git - 全局设置 git 的 core.precomposeunicode = true 安全吗?

标签 git

我们正在混合环境(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/

相关文章:

git - 在 Gerrit 中等待审查时,如何处理多个修复程序?

node.js - 如何将前端添加到已部署的后端项目(相同的存储库)

git - 使用 reposurgeon 将多项目 Subversion 存储库迁移到 Git

git - 从没有分支分支的封闭 pull 请求中挑选

git - 进行 git 提交时出现 Vi 错误

ruby - 无权访问 Heroku 应用程序

Git递归添加单个子目录

git - 使用钩子(Hook)强制特定格式的 git commit 消息

windows - Git 提交后 Hook : How to start a bat-file in Windows

git - git 可以使用 stash 对工作副本进行比较吗