windows 我可以使用 mSysGit 和 Cygwin 的 git 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/690502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I use mSysGit and Cygwin's git?
提问by skiphoppy
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.
迁移到 Windows 后,我将 msysgit 与其包含的 bash shell 一起使用,这对我来说效果很好。但是我有问题:我们的 ant 构建过程不会在那个 shell 中运行,我想使用 Cygwin 的 xterms 而不是 Windows 命令窗口,因为终端兼容性不够好,无法运行我想要的所有其他内容那个窗口等等。
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.
我实际上已经在 Windows 命令外壳中坚持使用 msysgit 以便我不必使用单独的窗口来构建,但这有更多问题:缺乏cd
- 和文件完成正在杀死我,大多数我想通过管道传输的命令不存在,等等。
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
?
因此,如果我改用 Cygwin 的 git,或者更糟的是,在不同的时间同时使用这两种工具,行尾是否会影响我?Cygwin 的 git 是否会期望一切正常\n
并认为它会看到变化,因为 mSysGit\r\n
在结帐时转换为?Cygwin 的 git 是否会检查\n
并混淆我的 Windows Eclipse,我肯定希望一切都是这样\r\n
?
回答by VonC
The simplest approach would be to set any git (msysGit or Cygwin git) to ignore crlf styles.
最简单的方法是设置任何 git(msysGit 或 Cygwin git)以忽略 crlf 样式。
core.autocrlf=false
That way, you do not have ant unwanted conflict.
这样,您就不会遇到不必要的冲突。
回答by Peter Boughton
Will Cygwin's git check out as \n and confuse my Windows Eclipse, which I'm sure wants everything to be \r\n?
Cygwin 的 git 是否会以 \n 的形式签出并混淆我的 Windows Eclipse,我确信它希望一切都是 \r\n?
Most modern applications (including Eclipse) are perfectly capable of using \n only.
大多数现代应用程序(包括 Eclipse)完全能够仅使用 \n。
There are a few annoying exceptions (e.g. email protocol), but in most cases you can stick to just using \n for everything.
有一些令人讨厌的例外(例如电子邮件协议),但在大多数情况下,您可以坚持只对所有内容使用 \n。
So, as VonC says, just disable the autocrlf setting and it'll be fine.
因此,正如 VonC 所说,只需禁用 autocrlf 设置就可以了。
回答by Peter Boughton
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/
从这篇文章 - “在 Windows 上使用 Msysgit 设置 GIT 服务器” - 用户建议了这个链接 - http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-视窗/
I used this setup and works flawlessly on Windows for Me.
我使用此设置并在 Windows for Me 上完美运行。
Hope it helps
希望能帮助到你
回答by T.E.D.
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.
实际上,仅仅坚持使用 msysGit 并不能拯救你。由于使用不同版本的 msysGit 时的行尾问题,我遇到了一个问题,其中每个源文件都显示为已更改。在 git 配置文件中设置 core.autocrlf 修复了它。
回答by NovelX
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".
我对行尾感到头疼。我正在使用 cygwin git,它总是将一些新签出的文本文件报告为“已修改”。当我将“core.autocrlf”从“true”更改为“input”时,十五个文件中有十个从修改列表中消失了,而在我将“core.autocrlf”设置为“false”后,剩下的五个消失了。
I can't vote for VonC's solution due to low reputation but I would say it works for me.
由于声誉低,我无法投票支持 VonC 的解决方案,但我会说它对我有用。
回答by WaffleSouffle
I set core.autocrlf to false in msysgit and took whatever cygwin installed by default.
我在 msysgit 中将 core.autocrlf 设置为 false 并采用默认安装的任何 cygwin。
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.
我在使用 cygwin 工具和 msysgit 随附的 mingw 工具从命令提示符处签出时遇到问题,因为文件模式发生了明显的变化(每个文件中的 755 似乎更改为 644)。这似乎是关于可执行位的问题。git reset 没有帮助。
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.
然而,从 msysgit GUI 窗口进行初始克隆并没有产生这个问题,我现在似乎可以从它自己的 bash shell 或命令提示符中自由使用 cygwin,或者从它的 bash shell 中使用 msysgit。换句话说,一切似乎都很愉快。
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.
因此,最重要的是,如果您看到每个文件似乎都在更改并且行尾似乎不是问题的原因,请尝试从 GUI 中查看。
回答by Timothy Meade
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
在调试了一段时间后,我为我的案例解决了这个问题。我以一种迂回的方式从 Linux 分区复制了 id_rsa 文件,将行尾保留为 LF (Unix) 格式。在 eclipse 中打开文件并将行尾转换为 Windows 解决了这个问题。另外,我按照以下说明将 GIT_SSH 设置为 Plink(来自 Putty):http: //www.mainelydesign.com/blog/view/git-plink-for-ssh-on-windows