windows 在另一个驱动器上的git配置问题

w8ntj3qf  于 2023-10-22  发布在  Windows
关注(0)|答案(2)|浏览(158)

所以我设置了一个git配置,有一个工作文件夹和一个个人文件夹:

  • 它的工作很好,我的个人文件夹女巫是在我的C驱动器(x1),它使用我的email protected(https://stackoverflow.com/cdn-cgi/l/email-protection)
  • 不为我的工作文件夹女巫是在我的D驱动器(FAT32),它使用email protected(https://stackoverflow.com/cdn-cgi/l/email-protection)(位于我的.gitconfig),但没有使用我的email protected(https://stackoverflow.com/cdn-cgi/l/email-protection)

我的用例是否可行?我没有找到一个教程与另一个驱动器作为C。也许git想要一个与exe相同的驱动器?如果有人能让这样的东西工作就好了。
这是我的.git配置(我已经测试过将两者的顺序颠倒,但没有改变任何东西)

[user]
    email = [email protected]
    name = Default

[includeIf "gitdir/i:D:/Work/**"]
    path = ~/.gitconfig-work
[includeIf "gitdir/i:C:/Personal/**"]
    path = ~/.gitconfig-personal

这是我的. gitter-work

[user]
    email = [email protected]
    name = Work

这是我的. gitter-personal

[user]
    email = [email protected]
    name = Personal

我试过在C盘的路径上调用. gitworld-work,它工作正常,所以问题不应该是. gitworld-work。准确地说,我已经改变了这样的东西,它的工作(我得到了email protected(https://stackoverflow.com/cdn-cgi/l/email-protection)):

[includeIf "gitdir/i:C:/Personal/**"]
    path = ~/.gitconfig-work

所以这里是我个人配置的结果(这一个工作:它使用我email protected(https://stackoverflow.com/cdn-cgi/l/email-protection))

PS C:\Personal> mkdir test

    Directory: C:\Personal

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           10/2/2023 12:17 AM                test

PS C:\Personal> cd .\test\
PS C:\Personal\test> git init
Initialized empty Git repository in C:/Personal/test/.git/
PS C:\Personal\test> git config --show-origin --get user.email
file:C:/Users/Sacha/.gitconfig-personal        [email protected]
PS C:\Personal\test>

这是我的工作配置的结果,它没有(它使用email protected(https://stackoverflow.com/cdn-cgi/l/email-protection))

PS D:\Work> mkdir test

    Directory: D:\Work

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           10/2/2023 12:16 AM                test

PS D:\Work> cd .\test\
PS D:\Work\test> git init
Initialized empty Git repository in D:/Work/test/.git/
PS D:\Work\test> git config --show-origin --get user.email
file:C:/Users/Sacha/.gitconfig  [email protected]
PS D:\Work\test>

顺便说一句,我的D驱动器是一个分区上的另一个(物理)驱动器在FAT32,我需要有我的工作在这个驱动器上,因为我的D驱动器是一个共享分区与流行操作系统22.04我需要我的两个操作系统来访问这个文件夹。

Git : git version 2.40.1.windows.1
Windows Version: 22H2

我已经测试了当分配一个真正的路径到我的D驱动器(所以我可以使用它像C:/共享),但没有改变任何东西。
感谢所有帮助我们的人。

guz6ccqo

guz6ccqo1#

你指的是使用相同的配置文件来配置(win/Linux)吗?考虑这些操作系统的路径格式。win使用“\“和Linux“/”可能是问题所在。至少我没有其他任何不相容的想法。

6xfqseft

6xfqseft2#

如果你想了解更多信息,这是我在github上发布的问题:https://github.com/git-for-windows/git/issues/4621
这是一个快速的答案,你需要在那个仓库中有足够的访问权限,所以通过在你的.gitconfig中添加这个,你应该能够让它工作:

[safe]
   directory = *

相关问题