我可以使用 mSysGit 和 Cygwin 的 git 吗?

发布于 2024-07-15 17:17:56 字数 546 浏览 5 评论 0原文

迁移到 Windows 后,我使用 msysgit 及其附带的 bash shell,这对我来说效果很好。 但我有问题:我们的 ant 构建过程无法在该 shell 中运行,我想使用 Cygwin 的 xterms 而不是 Windows 命令窗口,因为终端兼容性不够好,无法运行我想要的其他所有内容那个窗户,等等。

实际上,我已经尝试在 Windows 命令 shell 中坚持使用 msysgit,这样我就不必使用单独的窗口来构建,但这会带来更多问题:缺少 cd -文件补全快要了我的命,我想要通过管道传输的大多数命令都不存在,等等。

因此,如果我切换到使用 Cygwin 的 git,或更糟糕的是,在不同时间使用两者,行尾会被咬住我? Cygwin 的 git 是否会期望所有内容都是 \n 并认为它正在看到变化,因为 mSysGit 在签出时转换为 \r\n ? Cygwin 的 git 是否会签出为 \n 并混淆我的 Windows Eclipse,我确信它希望所有内容都是 \r\n

After migrating to Windows, I'm using msysgit with its included bash shell, and that's working well for me. But I have issues: our ant build process won't run in that shell, I'd like to use Cygwin's xterms instead of the Windows command window, since the terminal compatibility isn't good enough to run everything else I'd like in that window, and so on.

I've actually made a go of sticking with msysgit in the Windows command shell so that I don't have to use a separate window to build, but that's got even more problems: the lack of cd - and file completion is killing me, most of the commands I'd like to pipe to aren't present, etc.

So if I switch to using Cygwin's git, or worse, use both at different times, are line-endings going to bite me? Will Cygwin's git expect everything to be \n and think it's seeing changes because mSysGit converted to \r\n when checking out? Will Cygwin's git check out as \n and confuse my Windows Eclipse, which I'm sure wants everything to be \r\n?

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

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

发布评论

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

评论(7

去了角落 2024-07-22 17:17:57

最简单的方法是将任何 git(msysGit 或 Cygwin git)设置为忽略 crlf 样式。

core.autocrlf=false

这样,您就不会遇到不必要的冲突。

The simplest approach would be to set any git (msysGit or Cygwin git) to ignore crlf styles.

core.autocrlf=false

That way, you do not have ant unwanted conflict.

遗忘曾经 2024-07-22 17:17:57

Cygwin 的 git 会签出为 \n 和
混淆我的 Windows Eclipse,我是
确定希望一切都是 \r\n 吗?

大多数现代应用程序(包括 Eclipse)完全能够仅使用 \n。

有一些令人讨厌的例外(例如电子邮件协议),但在大多数情况下,您可以坚持仅使用 \n 来完成所有操作。

因此,正如 VonC 所说,只需禁用 autocrlf 设置就可以了。

Will Cygwin's git check out as \n and
confuse my Windows Eclipse, which I'm
sure wants everything to be \r\n?

Most modern applications (including Eclipse) are perfectly capable of using \n only.

There are a few annoying exceptions (e.g. email protocol), but in most cases you can stick to just using \n for everything.

So, as VonC says, just disable the autocrlf setting and it'll be fine.

不一样的天空 2024-07-22 17:17:57

从这篇文章 - “在 Windows 上使用 Msysgit 设置 GIT 服务器” - 用户建议了这个链接 - http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/

我使用了此设置,并且在 Windows for Me 上完美运行。

希望能帮助到你

From this post - "Setup GIT Server with Msysgit on Windows" - a user suggested this link - http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/

I used this setup and works flawlessly on Windows for Me.

Hope it helps

写给空气的情书 2024-07-22 17:17:57

事实上,仅仅坚持使用 msysGit 并不能拯救你。 我遇到一个问题,由于使用不同版本的 msysGit 时出现行结束问题,每个源文件都显示为已更改。 在 git 配置文件中设置 core.autocrlf 修复了它。

Actually, just sticking with msysGit won't save you. I had one issue where every single source file showed as changed because of the line-ending issue when using different versions of msysGit. Setting core.autocrlf in the git config file fixed it.

挽你眉间 2024-07-22 17:17:57

我对行尾感到头疼。 我正在使用 cygwin git,它总是将一些新签出的文本文件报告为“已修改”。 当我将“core.autocrlf”从“true”更改为“input”时,十五个文件中的十个从修改列表中消失了,而在我将“core.autocrlf”设置为“false”后,剩下的 5 个文件消失了。

由于声誉较低,我无法投票支持 VonC 的解决方案,但我想说它对我有用。

I got headache on the line endings. I'm using cygwin git, and it always report some newly checked-out text files as "modified". When I changed "core.autocrlf" from "true" to "input" ten out of fifteen files disappeared from the modified list, and the remaining 5 went away after I set "core.autocrlf" to "false".

I can't vote for VonC's solution due to low reputation but I would say it works for me.

说好的呢 2024-07-22 17:17:57

我在 msysgit 中将 core.autocrlf 设置为 false 并采用默认安装的 cygwin。

由于文件模式的明显变化(每个文件中的 755 似乎更改为 644),我在使用 cygwin 工具和 msysgit 附带的 mingw 工具从命令提示符进行检查时遇到了问题。 这似乎是关于可执行位的问题。 git重置没有帮助。

然而,从 msysgit GUI 窗口进行初始克隆并没有产生这个问题,而且我现在似乎可以从它自己的 bash shell 或命令提示符中使用 cygwin,或者从它的 bash shell 中使用 msysgit。 换句话说,一切看起来都很幸福。

因此,最重要的是,如果您看到每个文件似乎都发生了变化,并且行结束似乎不是问题的原因,请尝试从 GUI 中检查。

I set core.autocrlf to false in msysgit and took whatever cygwin installed by default.

I had problems checking out from a command prompt using cygwin tools and the mingw tools shipped with msysgit, because of apparent changes in file modes (755 appeared to change to 644 in every file). This appears to be an issue regarding the executable bit. git reset didn't help.

However, doing the initial clone from the msysgit GUI window did not produce this problem, and I now appear to be free to use cygwin either from its own bash shell or a command prompt, or msysgit from its bash shell. In other words everything seems happy.

So bottom line if you're seeing every file appearing to change and line-endings doesn't appear to be the cause of the problem, try checking out from the GUI.

天邊彩虹 2024-07-22 17:17:57

经过一段时间的调试后,我解决了我的情况。 我以迂回的方式从 Linux 分区复制了 id_rsa 文件,将行结尾保留为 LF (Unix) 格式。 在 eclipse 中打开文件并将行结尾转换为 Windows 修复了此问题。 另外,我按照以下说明将 GIT_SSH 设置为 Plink(从 Putty): http://www.mainelydesign.com/blog/view/git-plink-for-ssh-on-windows

After debugging this for a while I solved it for my case. I copied the id_rsa file from a Linux partition in a roundabout way leaving the line endings in LF (Unix) format. Opening the file in eclipse and converting the line endings to Windows fixed this. Also, I have GIT_SSH set to Plink (from Putty) following these instructions: http://www.mainelydesign.com/blog/view/git-plink-for-ssh-on-windows

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