【发布时间】:2019-10-23 13:56:35
【问题描述】:
我有以下设置:
- WSL 随 Ubuntu 一起安装,那里已经安装了 git
- 从 Windows 端的https://git-scm.com 安装的 git
- 通过打开开发人员模式并将我的用户添加到正确的策略组来启用符号链接创建,如 https://github.com/git-for-windows/git/wiki/Symbolic-Links 中所述
-
core.symlinks=true(由于上述行) -
core.autocrlf=false(我不希望 git 做任何聪明,我在 Windows 和 WSL 之间共享 repo)
这几乎完美运行(印象深刻)。当我克隆存储库时,在 Windows 和 WSL 中都可以,除了两侧之一的符号链接说它们已修改但未修改。两边的符号链接工作正确,我可以毫无问题地导航它们。
在初始克隆(在 Windows 端)之后,Windows PowerShell 给出:
PS C:\Users\Matthew\Projects\...> git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
但是在 WSL 方面,它表示这两个符号链接已被修改:
/mnt/c/Users/Matthew/Projects/...$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: t/browser
modified: web/jslib
no changes added to commit
但是 git diff 没有输出:
/mnt/c/Users/Matthew/Projects/...$ git diff
/mnt/c/Users/Matthew/Projects/...$
如果我随后在 WSL 端重置结帐,一切都会切换:
/mnt/c/Users/Matthew/Projects/...$ git reset --hard HEAD
HEAD is now at ......... Commit message here
/mnt/c/Users/Matthew/Projects/...$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
然后回到 Windows Powershell:
PS C:\Users\Matthew\Projects\...> git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: t/browser
modified: web/jslib
no changes added to commit (use "git add" and/or "git commit -a")
PS C:\Users\Matthew\Projects\...> git diff
PS C:\Users\Matthew\Projects\...>
似乎 git 正在设置一个内部标志,然后它认为在另一个系统中已更改;有什么办法可以解决或解决这个问题?
【问题讨论】:
标签: git windows-subsystem-for-linux