Can I use mSysGit and Cygwin's git?

試著忘記壹切 提交于 2019-11-27 22:26:58

问题


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?


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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.




回答5:


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.




回答6:


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.




回答7:


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



来源:https://stackoverflow.com/questions/690502/can-i-use-msysgit-and-cygwins-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!