简体   繁体   English

在 Vscode 中的容器中重新打开 - git 问题

[英]Reopening in a Container in Vscode - git issue

I have a project with a .devcontainer folder with appropriate setup files.我有一个带有适当设置文件的 .devcontainer 文件夹的项目。 So, through Vscode I can open the project in a docker container with the configured environment for development and testing.因此,通过 Vscode,我可以在配置了开发和测试环境的 docker 容器中打开项目。 But when I open it in a container all the files in the project are tagged as Modified.但是当我在容器中打开它时,项目中的所有文件都被标记为已修改。 But when I change any file, save it, and open it locally then only that file is modified.但是,当我更改任何文件、保存并在本地打开它时,只会修改该文件。

I'm not sure why this is happening and is this expected?我不确定为什么会发生这种情况,这是预期的吗?

So, I found the answer and the issue was with different line endings conversion between Windows(local env) and the docker container.所以,我找到了答案,问题在于 Windows(本地环境)和 docker 容器之间的不同行尾转换。 Using the following and cloning the repo again resolved the issue.使用以下内容并克隆 repo 再次解决了该问题。

git config --global core.autocrlf false

A detailed discussion is in the link below: https://code.visualstudio.com/docs/remote/troubleshooting#_resolving-git-line-ending-issues-in-containers-resulting-in-many-modified-files详细讨论在下面的链接中: https ://code.visualstudio.com/docs/remote/troubleshooting#_resolving-git-line-ending-issues-in-containers-resulting-in-many-modified-files

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

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