将存储库克隆到 Windows 时,如何阻止 git 添加回车符?

发布于 2024-07-24 18:22:16 字数 413 浏览 6 评论 0原文

我的笔记本电脑上仍然有 XP,并安装了 Git,以便我可以对其进行一些工作。 当我从我的服务器(Linux)克隆存储库时,它会自动在每一行添加回车符。 所以现在 Git 认为每个文件都已被修改,而事实上,它们没有。

我尝试将以下行添加到我的 .gitconfig 文件中但无济于事

[core]
    autocrlf = true

,或者

[core]
    autocrlf = input

我也尝试

git config core.autocrlf <value>

在有问题的存储库中运行,然后重置硬头。 这似乎也不起作用。 任何帮助,将不胜感激。

I still have XP on my laptop and have installed Git so that I can do some work on it. When I clone a repository from my server (which is linux) it automatically adds carriage returns onto each line. So now Git thinks that every file has been modified when, in fact, they haven't.

I've tried adding the following lines to my .gitconfig file to no avail

[core]
    autocrlf = true

or

[core]
    autocrlf = input

I have also tried running

git config core.autocrlf <value>

within the repository in question, and then reset hard to head. This also didn't seem to work.
Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

捂风挽笑 2024-07-31 18:22:16

为什么不“autocrlf = false?”。

Why not "autocrlf = false?".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文