[HN Gopher] Getting Started with Git Bash
___________________________________________________________________
Getting Started with Git Bash
Author : brlnwest
Score : 38 points
Date : 2022-02-03 10:57 UTC (2 days ago)
(HTM) web link (www.git-tower.com)
(TXT) w3m dump (www.git-tower.com)
| skywal_l wrote:
| As a die hard unix fan being forced to work on Windows, git bash
| is a godsend.
|
| Sure now you have WSL and countless other options but git bash is
| one click away and works surprisingly well.
| jrm4 wrote:
| Ha, I'm glad you got this. As someone who can use Linux all the
| time and does, "Windows" just seems sillier and sillier;
| especially with Proton et al.
| riedel wrote:
| I really wonder what make git bash so much more popular than
| msys2 or cygwin. Ever since switching from Linux/FreeBSD cygwin
| has lessened the pain of windows a lot.
| pletnes wrote:
| If you google <<git download>> or <<install git>>, that's
| what you get. There's also no package manager or 3rd party
| packages to worry about or learn how to use. That's my gut
| feel, at least.
|
| Git bash is based on some ancient cygwin version. You can see
| that e.g. the <<cygpath>> utility is still there. MinGW/Msys
| forked from cygwin due to some techno-political disagreement
| that I can't be bothered to learn more about.
| leppr wrote:
| It's simple, portable, and you can just execute EXEs from it.
|
| Cygwin has a more complex setup and not great compatibility
| with windows executables, IIRC.
| pletnes wrote:
| One example issue is that cygwin tries much harder to
| enforce a <<linux / chmod>> view of file permissions, which
| it tries to map onto the underlying windows/ ntfs
| permissions. This can cause issues like creating files that
| won't (easily) be deleted and other yak-shaving-inducing
| problems.
| riedel wrote:
| Cannot echo this at all. I use native binaries like pandoc
| or chocolatey from cygwin all the time. The only issue may
| be with stdout and file paths.
|
| There is still msys, if you want more windows. I think git
| bash mostly is only a packaged msys distribution, isn't
| it??
| michaelsbradley wrote:
| > There is still msys
|
| MSYS2 is the better option, and is not "MSYS version 2",
| it's an independent rewrite.
|
| > git bash mostly is only a packaged msys distribution,
| isn't it?
|
| It's in parts based on MSYS2, but doesn't give you a
| "full install" (or whatever is the best way to phrase
| it).
| riedel wrote:
| Sorry for being sloppy I meant msys2.
| michaelsbradley wrote:
| > Cygwin has a more complex setup and not great
| compatibility with windows executables, IIRC.
|
| And that's how/why MSYS2 is a nice alternative to Cygwin,
| especially its environments that use UCRT instead of MSVCRT
| when considering "compatibility" from the perspective of
| building and shipping software that doesn't require the
| user to first install a special environment/runtime. UCRT
| ships by default on Windows 10.
| riedel wrote:
| Totally: if you want to redistribute stuff msys2 makes
| this much easier. I have both on my system.
|
| As a shell environment I like cygwin. With posix
| compatibility I can compile nearly everything (that does
| not use libuv).
|
| I do not get the narrative of complicated setup for this
| use case. Download installer and click next a few times:
| does not seem to be so difficult. The cygwin package
| installer IMHO is a bit easier to use than pacman.
| ur-whale wrote:
| > I really wonder what make git bash so much more popular
| than msys2 or cygwin
|
| cygwin is so slow it's basically unusable for most tasks
| except the simplest ones.
|
| _especially_ if you run anything with threads.
| otachack wrote:
| My experience with Cygwin back in college (~2008) was that it
| was obtuse and hard to understand. Granted, I didn't have the
| knowledge of *nix CLI I have now.
|
| But looking back and comparing it to Git Bash experience of
| today, with a simple installer to run, Git Bash wins in
| convenience. It does suck in other areas though such as
| trying to start a Python interpreter session (I fallback to
| PowerShell for that)
|
| Cygwin has probably grown a lot better since but I don't see
| a reason to try it, personally.
| ChrisSD wrote:
| What's the Python issue?
| lozenge wrote:
| There's no package manager so there's no way to install
| things and there's no Python included.
|
| You could run your Windows Python but the paths will be
| wrong (C:\ instead of /c/), etc.
| pletnes wrote:
| Git bash will translate /c/ to C:\ so that's only
| sometimes true. But it won't translate //c/ or if you set
| a certain env var... etc. Having to recall all these
| rules is one reason I dislike working in git bash on
| windows.
| jliu70 wrote:
| The workaround to running the python interpreter from git
| bash is to preface python with the command winpty like so
| `winpty python`
|
| Reference: http://willi.am/blog/2016/08/08/docker-for-
| windows-interacti...
| gruez wrote:
| >I really wonder what make git bash so much more popular than
| msys2 or cygwin
|
| Not sure about cygwin, but I thought git bash was based on
| msys2?
| MithrilTuxedo wrote:
| The enterprise bank I work for needs a business justification
| to spend resources to figure out if there's a business
| justification for allowing the installation of WSL. I asked in
| 2019.
|
| Bouncing between my personal computers and my Windows work
| computer, what they've done to make git so slow... it makes me
| sad. On a brand new developer workstation, the git-prompt
| invocation in PS1 takes over a second to complete.
|
| Developers who never used git before don't like it and I
| understand why. It's like a scene from Harrison Bergeron, like
| Git Bash has heavy objects strapped to it to make it at least
| as slow as everything else.
| michaelsbradley wrote:
| It's owing to the high number of syscalls not being a big
| drag on Linux, etc. while causing noticeable slowdowns on top
| of Windows' architecture/filesystem... something like that. A
| Microsoft engineer did a good writeup on it several years
| ago, if I remember correctly. I'll try to find a link.
| michaelsbradley wrote:
| I think this is what I had in mind:
|
| https://github.com/Microsoft/WSL/issues/873#issuecomment-42
| 5...
| agurk wrote:
| I was recently in a very similar situation to you and found
| that the $PATH of my git bash contained a network drive.
| Removing this for me made it still slow but useable.
|
| This also made any programs I was running in it - like vim -
| useable too.
| binarymax wrote:
| Nice intro. I had to go through this yesterday on a cloud
| instance and hadn't used windows in awhile. Instead of using this
| install GUI I first installed chocolatey. Once that was ready
| from powershell it's a quick 'choco install git'.
|
| Getting visual studio build tools wasn't as easy (was compiling
| rust/c++ so had it as a dependency). I managed to avoid Internet
| explorer entirely by 'choco install Firefox' and then managed to
| go through the painful web workflow VS community edition
| download.
|
| I really wonder how I managed on Windows for so long in my former
| career. It's night and day vs Linux or Mac.
| easton wrote:
| winget is built into Windows 10 and 11 and works as well as
| chocolatey (in 90% of cases, still some apps missing).
| winget install -s winget git ; winget install -s winget firefox
| ; winget install -s winget vs2022-buildtools --interactive
|
| will get you what you listed. the "-s winget" option bypasses
| the Microsoft Store source, but you can permanently remove that
| with "winget source remove msstore". if you want to browse for
| more apps (and generate commands to install them) you can with
| https://winstall.app.
| brnt wrote:
| I co-maintain a piece of software and I would love to have a
| Windows binary. We have few dependencies, all well behaved and
| we dont use any OS APIs. It's a Cmake projectand I'm sure if I
| would get it to compile on Windows it would work fine.
|
| I gave it a shot twice, first by hand, second time through
| Github CI. I just don't get how any of this works on Windows.
| michaelsbradley wrote:
| With MSYS2 installed on your Windows cloud instance, in a Bash
| shell for e.g. its UCRT64 environment, you could use pacman to
| get your dev setup in place: pacman -S base-
| devel git mingw-w64-ucrt-x86_64-toolchain
| mingw-w64-ucrt-x86_64-rust
|
| Other build tools like cmake, etc. are also readily available
| via pacman. I've found this approach helps make developing on
| Windows a lot more like I want, i.e. more like my experiences
| on Linux and macOS.
|
| Whether the "-toolchain" package in the install-list above (gcc
| and friends) is suitable for your needs, I'm not sure, though
| note that the "-rust" package brings in llvm automatically, so
| your bases are probably covered unless you have a strict
| requirement to use Microsoft's toolchain.
| getcrunk wrote:
| This article is from Jan 2022, I don't understand why the author
| didn't mention wsl. Even just to point out if it's lacking
| compared to gitbash. Can anyone chime in?
| 0xbadcafebee wrote:
| Can anyone paste a list of all the commands available from Git
| Bash? (not the bash builtins, but all the added programs)
| [deleted]
| noselasd wrote:
| https://justpaste.it/7hnyq
| 0xbadcafebee wrote:
| Thank you!!!
|
| Wow, they have Perl! And curl, ssh/sshd, gpg,
| md5/sha/lzma/zip, nano/vim/antiword, openssl, strace, and
| Busybox. That's a decent little environment!
| jancsika wrote:
| how does git bash
|
| versus
|
| msys2?
|
| E.g., with msys2 i can install sshd so that I can use a windows
| vm as a gitlab runner. I can also use pacman to install build
| deps.
|
| Can i with git bash?
| rashil2000 wrote:
| No, Git Bash is a custom, stripped-down version of MSYS2 (with
| MinGW Git and its dependencies installed). It does not include
| pacman.
|
| If you want to use pacman you can either use Git Windows SDK,
| or just plain MSYS2.
| [deleted]
| michaelsbradley wrote:
| Git Bash is a nice tool. I used it for some time, and still do in
| some circumstances.
|
| But when I wanted to have more and do more from the command-line
| re: a *nix-like dev experience on Windows for building native
| Windows software, I found my way to MSYS2[1]. Note that Git Bash
| is in parts based on MSYS2, but installing and using MSYS2 is not
| 1-1 with installing and using Git Bash:
|
| At first I didn't quite understand what I was working with, but
| MSYS2's website provides the needed info, I just had to take the
| time to read it.
|
| The History[2] page helped me understand better the relationships
| and differences between MSYS2, MSYS (not "2"), MinGW/-w64, and
| Cygwin. One of the more salient points being:
| MSYS2 is an independent rewrite of MSYS, based on modern Cygwin
| and MinGW-w64 with the aim of better interoperability with native
| Windows software ... MSYS2 is ideologically a successor to MSYS
| and MinGW. MSYS -- although definitely useful -- is really old
| and getting in the way of developers. MSYS2 was created to
| replace the original MSYS while avoiding its problems.
|
| Other pages provide complementary information on that same topic.
|
| Another thing I appreciated was the explanation of MSYS2's
| environments[3]. Being able to painlessly switch away from MSVCRT
| to UCRT was helpful in solving some UTF-8 difficulties I was
| experiencing.
|
| Package management with pacman[4] is rather pleasant, and the
| setup-msys2[5] GitHub Action makes it simple to provide your GHA
| workflow with the tools and libs you want.
|
| Whenever I've encountered a problem or had a question I couldn't
| answer via web search, the community on the MSYS2 Discord
| server[6] has always been quick and happy to help.
|
| [1] https://www.msys2.org/
|
| [2] https://www.msys2.org/wiki/History/
|
| [3] https://www.msys2.org/docs/environments/
|
| [4] https://www.msys2.org/docs/package-management/
|
| [&] https://packages.msys2.org/queue
|
| [5] https://github.com/msys2/setup-msys2
|
| [6] https://www.msys2.org/contact/
| synergy20 wrote:
| git bash is great.
|
| with WSL2 I can use git directly, so I uninstalled git-bash and
| all those msys/cygwin/mingw, things changed, embrace WSL2, move
| on.
___________________________________________________________________
(page generated 2022-02-05 23:01 UTC)