Git under windows: MSYS or Cygwin?
Asked Answered
S

13

80

I plan to migrate my projects over to git, and I'm currently wondering which is the best and / or most stable option under windows.

From what I gather I basically have 2.5 options:

  1. MSYSgit
  2. git under Cygwin
  3. (aka 2.5) MSYSgit from a Cygwin prompt (given that Cygwin git is already installed).

Note: IMO Cygwin in itself is a big plus as you can have access to pretty much all the *nix command line tools, as where with MSYSgit bash, you only have access to a rather small subset of these tools.

Given that, what option would you suggest?

Skittish answered 23/4, 2009 at 23:1 Comment(0)
C
61

Edit (2 more years later: October 2014)

Johannes Schindelin just explained (Oct. 2014) that msysgit is phased out:

we now have a light-weight Git for Windows SDK – which is essentially a standard MinGW/MSys system managed through the package manager mingw-get.

We decided to just phase out the name "msysGit" (as well as the GitHub org of the same name) and work on Git for Windows (with the corresponding GitHub org), and using the name "Git for Windows" for the installer aimed at "end-users" and "Git for Windows SDK" for the development environment targeting Git for Windows developers).


Edit (3 years later: April 2012)

MsysGit (now on GitHub) is the way to go if you want a light-weight fast start in Git world: unzip the archive, launch git-cmd.bat or git-bash.bat and you are done.
Its latest release (1.7.10, April 2012) now includes support for UTF-8, also included in GitExtension. Don't forget to set your autocrlf to false though.

If you are really missing all the other unix commands not packages with msysgit, simply download a release of GoW (Gnu on Windows), aptly named "The lightweight alternative to Cygwin".
I mean: 130 unix commands...

Cygwin should be a backup solution only for certain cases, like the transfer speed of large Git repositories, as mentioned below by incrementor in his answer.


June 2012: if you want to interact with GitHub, you now have http://windows.github.com (see also "Designing GitHub for Windows").
It not only will configure the ssh keys for you (and add the generated public key to your GitHub profile), but it will also install, for all git operations, a... MsysGit.


Original answer (April 2009)

I have no problem with the latest version of MsysGit:
I use the option 2, which means I only add the git\bin directory to the PATH environment variable, but without overriding some built-in windows tools.

I managed to defined external tools like Notepad++ and WinMerge (or DiffMerge)

I did run successfully scripts like svn2git because, from MsysGit1.6.2+, it does include the 'git svn' command.

And finally I look forward to MsysGit1.6.2.3 for it will include finally 'git filter-branch' command! (a slow version of filter-branch, but still).

For the Unix command, I prefer to install a GnuWin32 coreutils package, and use them only when I need them.

So all in all, I do not use the Cygwin layer, and managed to run Git very well in its Windows-based release MsysGit.

Chad answered 24/4, 2009 at 6:29 Comment(9)
I use p4merge as well, which is pretty cool. I've read that there are issues with git & unicode file names.Electrograph
Thanks for linking to the core.editor setting question. (I tried to use Notepad++ with command line switches like -nosession and -multiInst)Dineen
This answer doesn't really answer why one would use one over the other. There are better answers below IMOWorse
@SebastienMartin you should mention it to the OP (Joce) in that case. Otherwise he won't be notified of the better answer he ought to select.Chad
@SebastienMartin I have updated this old answer with more current information.Chad
Thanks for the update 3 years later(!). Open source normally is a shifting landscape; this question is equally relevant as 3 years ago.Ferret
"Don't forget to set your autocrlf to false though." Yeah, screw poor defaults.Bhili
@Chad 1.5 year late, but... So, MSysGit is Git for Windows and Git for Windows is MSysGit, right? It's just a branding thing?Skittish
@Skittish no, msygit was git for Windows using the msys 1.0. Git for windows is now using msys2 projects. Links are listed in https://mcmap.net/q/12302/-why-is-it-that-if-you-download-git-2-0-from-the-net-you-always-get-a-1-9-4-installer-package.Chad
O
15

Yes. Old question. New answer:

We have been using MSYSgit for about 2 years now in a large deployment. The speed of transfers from a local git repository server have been limited to less than 5 MiB/s. Earlier investigation into the issue indicated that the problem was with MSYS devs being on Windows XP and Windows 7 security limiting connections from command prompt/bash shell. This does not appear to be, in fact, the problem.

I discovered Darrell Mozingo's blog posting and tested a clone of a large (many GiB) repo using only a Cygwin install. Transfer speeds were in the 30 MiB/s range. The problem is that MSYSgit uses an antique OpenSSH binary from 2007.

To this end, until that gets fixed, I am now recommending a shift to Cygwin (even though the version of git is a bit behind). I also found Cygwin to be more stable and less likely for perl to run out of memory.

Oliver answered 11/2, 2012 at 4:35 Comment(1)
It looks like MinGW is using OpenSSH 5.4 which is from 2010Anlage
P
9

I've dabbled with using both the MSYS and Cygwin versions of git, and to be really honest, I didn't find either experience especially good. I just don't think git is really ready for windows yet.

That being said, one issue I found with the MSYS version is that it would convert the line-endings on your (non-binary) files from UNIX style (line-feed) to DOS style (carriage-return/line-feed). You may consider this a bug or a feature, but there is no way to change the behaviour that I could find. (EDIT: Set the configuration variable core.autocrlf to false. Thanks Brian.)

OTOH, the MSYS version of git has some GUI functionality that isn't available in the cygwin version unless you want to install and run a whole X server. (Thanks Joce for confirming this.)

My impression is that the MSYS version is more popular, although that may be because you don't need to install a cygwin ecosystem to use it. (And I agree, cygwin is extremely useful.)

Personally, I would go with either Bazaar or Mercurial, either of which have better support for windows IMO.

Probationer answered 24/4, 2009 at 2:50 Comment(6)
Bazaar was also my solution to the question of Git on Windows. Heh.Stauder
You can turn off the line ending translation. You just need to set core.autocrlf to false.Myriagram
We're currently checking our options for a choice of DCVS. Mercurial is on the list. However the cost of branching, especially for very large projects, is quite a turn off. The Cygwin dist comes with a GUI front-end (at the cost of running an X server). However, I'm not entirely sure how much value it adds.Skittish
I'm using the msys version, and do not encounter any problems.Confraternity
I think the latest version of msys asks you to configure how line endings are handled when you install it.Enthalpy
"install and run a whole X server" is actually pretty painless on Cygwin -- just tick a box during the install and add a shortcut to your Startup folder.Megohm
P
7

Both Cygwin and Msys Git work fairly well for normal use-cases. If you want to use scripts such as git-svn, Cygwin is a better bet. As an old Windows users who finally jumped ship to Linux, I can definitely say that Cygwin is a great boon and worth having in and of itself.

Context is important though; what projects are these? Who are they used by? Etc.

Pasteur answered 24/4, 2009 at 2:55 Comment(1)
We're talking about a rather large project (32K+ source files) developed by a rather small team (~10 progs). Not all of them are proficient w/ *nix environment, but the simplicity of git for the day to day use looks promising. We also plan to use branching a lot e.g. One P4 changelist <=> One git branch. For that reason alone, git is much more interesting than Hg for example. My fear in Cygwin vs. MSYS is that the Cygwin version isn't as up to date os the MSYS one.Skittish
C
6

I've also tested both worlds (CygWin and MSysgit), my experiences is also that there are some shortcomings in the MSysgit bash. Unable to run git stash sucessfully while Cygwin handled it gracefully on the same git repo.

No deep analysis done yet, though...

Chaeta answered 18/3, 2010 at 15:39 Comment(0)
C
4

I currently use Msysgit together with TortoiseGit.

The MsysGit UI isn't really to my liking so I use a familiar tool like TortoiseGit and when working on the commandline (most of the time), I use the git binary from Msysgit

Cresset answered 12/9, 2009 at 16:55 Comment(0)
M
3

I'd recomment msysgit. Especially if it is used with Git Extensions: it provide easy way to configure environment: editor/diff/merge tools, and allows to do advanced git operations from the user interface.

Microcopy answered 5/3, 2011 at 20:30 Comment(0)
F
1

I have run into serious bugs in MSys's cygwin implementation: some commands, especially the rebase, were quite prone to failure. Cygwin's was much more stable for me.

That said, it was a month ago, might have improved since.

Fruiter answered 11/5, 2009 at 21:7 Comment(2)
"MSys's cygwin"? don't you mean MSys's Git?Skittish
@Alex Gontmakher Perhaps it's more stable but it is also slow-to-death. See this post: stackoverflow.com/questions/6724471/…Raisin
G
1

I have used both Cygwin Git and Msysgit with Windows. I would suggest using Cygwin + Git. Cygwin 1.7 (currently in beta) addresses a major nuance (at least for me) while using git gui and gitk. Earlier versions of Cygwin used to open 10s of cmd windows every time I do something in git-gui or gitk. This has been addressed in 1.7. Cygwin's powerful shell brings in a lot of the goodies of linux terminal as well.

That said, Msysgit has evolved quite a bit and is really useful in Windows. I faced a couple of issues though.

Permission issue: a few files created natively in windows had mode 755 which got converted to 644 while using Msysgit. This would show up as modified files. A checkin should fix this issue.

CRLF: The all elusive CRLF as usual creates issues in Windows. Msysgit might report files as modified. This can be fixed by selecting "Leave line endings unchanged" (forgot the exact text) while installing Msysgit.

Daemon: And yeah I'm still finding it tough to setup git daemon in Msysgit.

Grieve answered 17/11, 2009 at 9:50 Comment(0)
A
1

New answer to an old question ...

I'm using git 1.7.3 from a Windows 7 cmd shell, and it works great. I use a mix of git command line and git gui, and both have been working fine for months. We did have carriage return/line feed issues, exacerbated when we added Mac developers to the team, but these were resolved with ...

core.autocrlf=true
core.safecrlf=false

Not saying you shouldn't use a *nix-y shell, just that it isn't necessary.

Awakening answered 6/4, 2011 at 17:41 Comment(0)
D
0

I have reservations towards CygWin because I only want git and not any of the other tools that Cygwin wants to shove in. Normally you want your windows computer to work like a windows computer and CygWin wants to slap on something completely different. Slapping on *nix functionality just for the kicks is not to go.

The thing is, if I ever want to work with *nix like command line, I'd go over to my Linux machine and work on that computer instead. Virtual computers and remote desktops work like a charm nowadays and is accessible enough for developers.

There really needs to be a legitimate reason for you to be using CygWin. If it is just for using git I'd suggest you use MSysGit instead which is my preference. It works really well with the gitk and git-gui tools that are bundled. I've been working on both Eclipse and Visual Studio using msysgit and it works like a charm.

The only thing I'm waiting for now is a fully working Tortoise clone for git.

Dodecahedron answered 24/4, 2009 at 6:58 Comment(1)
And it appears least as of 3/13/17 Cygwin is at 2.8.3 git and I had a bit of Perl issues when updating. Git Bash MinGW is at 2.12.Kinser
D
0

There is one scenario under Windows where you simply have to use Git via Cygwin: This is when you want to use Git against a SVN server, which expects SVN client versions higher than 1.5. There exist SVN pre-commit hooks which block commits when there's no 'mergeinfo' argument - and the 'mergeinfo' argument is default in SVN only since version 1.5. The problem with msysGit is, that it is build against an older SVN version (1.4.6), so you can't successfully commit in this case. But it is possible with Cygwin's Git, since it is build against newer SVN versions.

Detail answered 1/6, 2012 at 8:15 Comment(0)
L
0

If you just want to do simple actions like push/pull/branching you could try SourceTree from Atlasian. A very simple and clear UI for Git command. However it has short coming.

If you need to use the command-line git tool, just get the Git for windows tool. It should be enough, unless you start looking in bash scripting.

Lascar answered 19/3, 2015 at 12:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.