【问题标题】:How to make repository portable between Windows and Linux (case sensitivity inside .git)?如何使存储库在 Windows 和 Linux 之间移植(.git 中区分大小写)?
【发布时间】:2022-09-27 11:54:13
【问题描述】:

我有一个主要在 Linux 上工作的存储库。现在我想将它复制到 Windows 机器上。但是在 .git 我有两个如下文件(仅以防万一):

.git/logs/refs/remotes/origin/xyz-1012-see-more
.git/logs/refs/remotes/origin/XYZ-1012-see-more

有没有办法在此存储库上运行脚本以使其可移植到 Windows?还是我只是坚持使用这两个遥控器,因为它们在远程服务器上如此?

谢谢

  • Windows 无法正确处理这种情况。如果您需要跨平台使用此 repo,理想的做法是在 Linux/Mac 机器上重命名其中一个文件,然后再尝试在 Windows 上查看此 repo。
  • NTFS 可以处理它,大多数应用程序不能。

标签: linux windows git filesystems


【解决方案1】:

不幸的是,没有办法在 Windows 上正确处理这个问题。


在 linux 方面,您可以发现有问题的分支/标记/远程分支名称:

# list all ref names :
git for-each-ref --format="%(refname:short)"

# shell way to spot which names are going to yield case issues :
git for-each-ref --format="%(refname:short)" | tr '[A-Z]' '[a-z]' |\
    sort | uniq -c | awk '{ if ( $1 > 1 ) print $2; }'

(另一种方法是用你喜欢的语言编写一个脚本来处理git for-each-ref 的输出)

一旦你发现了这些,你可以选择一种方法来重命名这些分支/标签/远程分支......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-27
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多