git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.19k stars 2.49k forks source link

Unable to launch Git bash app #4940

Closed yogendraapawar closed 1 month ago

yogendraapawar commented 2 months ago

Setup

$ git --version --build-options

**
git version 2.45.0.windows.1
cpu: x86_64
built from commit: b5d0511969ccd9ab86395c37e5a7619d8b4e7c32
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
**
$ cmd.exe /c ver

** Microsoft Windows [Version 10.0.22631.3447] **
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
> type "$env:USERPROFILE\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

**type "C:\Program Files\Git\etc\install-options.txt"
Editor Option: VIM
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled **

Details

Git is totally accessible from any terminal/ shell but I have an issue launching git bash from shortcut, as well as from anywhere else

** I am trying to open git bash from here, image

On launching bash I see this window and it closes instantly, within a second I tried running it as admin, it still didn't work Below is the screenshot of the opened window image

**

I can provide the commit id b5d0511969ccd9ab86395c37e5a7619d8b4e7c32 here it is

dscho commented 2 months ago

Please open a PowerShell window and call & "C:\Program Files\Git\bin\bash.exe" -li. Does this work? If not, could you copy/paste the error message that is shown?

yogendraapawar commented 2 months ago

When I run this command, below mentioned message briefly appears before the PowerShell window clears and restarts.

Usage: /usr/bin/bash [build | run]

When i try to open the bash terminal from vs-code I get this message

The terminal process "C:\Program Files\Git\bin\bash.exe" terminated with exit code: 1. image

I also tried reinstalling the git bash, but it still doesn't work

rimrul commented 2 months ago

Usage: /usr/bin/bash [build | run]

That seems wrong. The usage string that /usr/bin/bash produces should be something like Usage: /usr/bin/bash [GNU long option] [option] ….

dscho commented 2 months ago

In addition to @rimrul's concerns, what does & "C:\Program Files\Git\usr\bin\bash.exe" -li show (note the added usr\)?

yogendraapawar commented 2 months ago

hi @dscho and @rimrul

https://github.com/git-for-windows/git/assets/87609565/83d2d6df-b4e0-4e54-bf85-174575065a46

In the above video you can see that I am running & "C:\Program Files\Git\usr\bin\bash.exe" -li this command, a message Usage: /usr/bin/bash [build | run] appears for a while and instantly disappears.

dscho commented 2 months ago

Wow, that's definitely very, very wrong.

In my v2.45.0 installation, the SHA-256 of C:\Program Files\Git\usr\bin\bash.exe is:

PS C:\Users\me> Get-FileHash "C:\Program Files\Git\usr\bin\bash.exe"

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          19AF3E33574FF81B86DA0679E3E81E7051AB2ECE082EE10C1887F7AAF9E06BB0       C:\Program Files\Git\usr\bin\bash.exe

What's yours?

yogendraapawar commented 2 months ago
PS C:\> Get-FileHash "C:\Program Files\Git\usr\bin\bash.exe"

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          19AF3E33574FF81B86DA0679E3E81E7051AB2ECE082EE10C1887F7AAF9E06BB0       C:\Program Files\Git\usr\bin\bash.exe

same as yours

dscho commented 2 months ago

@yogendra131994 maybe you can monitor using ProcMon which executable gets called?

yogendraapawar commented 1 month ago

Logfile.CSV Here's the csv I exported after running git-bash after applying the filter to monitor git-bash.exe

dscho commented 1 month ago

@yogendra131994 maybe you can have a go at analyzing this yourself first? I am stretched too thin right now and cannot assist.

yogendraapawar commented 1 month ago

@dscho yes I'm also working on it

yogendraapawar commented 1 month ago

I tried searching about the issue and found this conversation on reddit, I tried this and my problem was resolved

I had .bashrc script in my User Profile "C:\Users\YogendraPawar" directory, I simply deleted it and was able to launch git-bash.exe.

Thank you @dscho and @rimrul for sharing your insights and helping me with the issue! I am closing this issue.