简体   繁体   English

WSL2 中克隆的 git 存储库不断消失。 这是为什么?

[英]Cloned git repository in WSL2 keeps disappearing. Why is that?

I have cloned a git repository, from Gitlab, in WSL2, using the Ubuntu distribution, and when I start up the WSL2 on another time it is gone.我使用 Ubuntu 发行版在 WSL2 中从 Gitlab 克隆了一个 git 存储库,当我在另一次启动 WSL2 时它消失了。

Can anybody tell me why this could happen?谁能告诉我为什么会发生这种情况?

There is an ongoing issue related to WSL2 and files disappearing存在与WSL2 和文件消失有关的持续问题

It can depend on your OS (W10? Which version? W11?) and if you have applied the latest Windows updates.它可能取决于您的操作系统(W10?哪个版本?W11?)以及您是否应用了最新的 Windows 更新。

Check first %APPDATA%/Local/Packages/ if you see your files (before restarting WSL2).如果您看到您的文件(在重新启动 WSL2 之前),请首先检查%APPDATA%/Local/Packages/

And check, as in issue 6221 , if rootfs is still visible.并检查,如issue 6221 所示rootfs是否仍然可见。 For instance: :\Users\<user>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs例如: :\Users\<user>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs

After doing a git clone, I am finding that the directory is empty.完成 git 克隆后,我发现该目录是空的。 This seems to only happen if I ran git clone from a bash script.这似乎只有在我从 bash 脚本运行 git clone 时才会发生。

I also discovered that doing "cd."我还发现做“cd”。 fixed the current instance of the problem and the files show up.修复了问题的当前实例并显示文件。 A bit of a pain to always have to do this.总是必须这样做有点痛苦。 Unfortunately adding this command to the script doesn't help.不幸的是,将此命令添加到脚本中并没有帮助。 You have to type it in at the bash prompt.您必须在 bash 提示符下输入它。

Hope this workaround helps.希望此解决方法有所帮助。

Michael Milette米莱特

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM