Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
吉特;“与工作树分离的存储库”;解决方案无法在Windows下工作_Windows_Git - Fatal编程技术网

吉特;“与工作树分离的存储库”;解决方案无法在Windows下工作

吉特;“与工作树分离的存储库”;解决方案无法在Windows下工作,windows,git,Windows,Git,请参见我链接到该问题的答案: 在最新的Git for windows下,我根本无法实现这一点。(Windows 7 x64) 我使用了git bash: <my username> /d/<worktree> $ git --git-dir=/c/dev/gitrepo/repo.git --work-tree=. init && echo "gitdir: /c/dev/gitrepo/repo.git" > .git Initialized e

请参见我链接到该问题的答案:

在最新的Git for windows下,我根本无法实现这一点。(Windows 7 x64)

我使用了git bash:

<my username> /d/<worktree>
$ git --git-dir=/c/dev/gitrepo/repo.git --work-tree=. init && echo "gitdir: /c/dev/gitrepo/repo.git" > .git
Initialized empty Git repository in c:/dev/gitrepo/repo.git/
/d/
$git--git dir=/c/dev/gitrepo/repo.git--work tree=。init&&echo“gitdir:/c/dev/gitrepo/repo.git”>.git
已在c:/dev/gitrepo/repo.Git中初始化空Git存储库/
然后我试着:

<my username> /d/<worktree>
$ git status
fatal: Not a git repository: /c/dev/gitrepo/repo.git
/d/
$git状态
致命:不是git存储库:/c/dev/gitrepo/repo.git
所以我尝试了一些稍微不同的东西,这要感谢windows路径的存储方式

<my username> /d/<worktree>
$ git --git-dir=/c/dev/gitrepo/repo.git --work-tree=/d/<worktree> init && echo "gitdir: /c/dev/gitrepo/repo.git" > .git
Initialized empty Git repository in c:/dev/gitrepo/repo.git/
/d/
$git--git dir=/c/dev/gitrepo/repo.git--work tree=/d/init&&echo“gitdir:/c/dev/gitrepo/repo.git”>.git
已在c:/dev/gitrepo/repo.Git中初始化空Git存储库/
这是复制粘贴逐字复制,除了我将用户名和一个目录名更改为
,用于SO

然后我尝试了以下方法:

<my username> /d/<worktree>
$ git status
fatal: Not a git repository: /c/dev/gitrepo/repo.git
/d/
$git状态
致命:不是git存储库:/c/dev/gitrepo/repo.git
然后我查看了/c/dev/gitrepo/repo.git/config中的内容,我看到了以下内容:

worktree = d:/<worktree>
worktree=d:/
也许这对windows路径表示法不起作用。所以我改变了它:

worktree = /d/<worktree>
worktree=/d/

还是不走运。在git for Windows下,我试图做的事情是否可行?

我在这个问题上取得的唯一进展是发现在我使用的工作站上,SUBST命令用于创建驱动器D。也就是说,C和D实际上是相同的物理驱动器

尽管如此,SUBST似乎并没有完全破坏Git。我在驱动器D上有一个项目,在驱动器D上有一个完全不同的目录上的git repo,一切正常

username@host /d/ProjectName (branch)
$ cat .git
gitdir: d:\gitrepo\ProjectName.git
因此,我得到的最佳答案是一个解决方案,我建议:在Windows中可能存在以下问题:

1.  If the repo and working dir are on different drives
2.  If (1) is true and you use SUBST
但无论哪种情况,解决方法都是以下一种或两种:

1.  put everything on the same drive letter.  It works even if that drive is a 'subst' drive.
2.  Use the windows "d:\" notation in the .git file

我在这个问题上取得的唯一进展是发现在我使用的工作站上,SUBST命令用于创建驱动器D。也就是说,C和D实际上是同一个物理驱动器

尽管如此,SUBST似乎并没有完全破坏Git。我在驱动器D上有一个项目,在驱动器D上有一个完全不同的目录上的git repo,一切正常

username@host /d/ProjectName (branch)
$ cat .git
gitdir: d:\gitrepo\ProjectName.git
因此,我得到的最佳答案是一个解决方案,我建议:在Windows中可能存在以下问题:

1.  If the repo and working dir are on different drives
2.  If (1) is true and you use SUBST
但无论哪种情况,解决方法都是以下一种或两种:

1.  put everything on the same drive letter.  It works even if that drive is a 'subst' drive.
2.  Use the windows "d:\" notation in the .git file