git-for-windows / git

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

Errors opening Git Bash within the Windows Terminal #4972

Closed ATECoder closed 4 weeks ago

ATECoder commented 1 month ago

Setup

$ git --version --build-options

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

Microsoft Windows [Version 10.0.22631.3593]
# 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

Editor Option: Notepad++
Custom Editor Path: 
Default Branch Option: main
Path Option: Cmd
SSH Option: ExternalOpenSSH
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: Enabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled

this happens with terminal or power shell (rev. 7.4.4) both when running as user (local user with Administrator privileges) or running the app as an Administrator. The errors appear whenever a new git bash is opened.

The host and other files reported as missing (see below) do exist in the windows est folder:

PS C:\Users\David> dir c:\windows\system32\drivers\etc

    Directory: C:\windows\system32\drivers\etc

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2024-05-24     19:34          12810 hosts
-a----        2021-06-05     05:08            824 hosts-original
-a----        2022-10-15     11:43            436 hosts.ics
-a----        2022-05-06     22:22           3683 lmhosts.sam
-a----        2021-06-05     05:08            407 networks
-a----        2021-06-05     05:08           1358 protocol
-a----        2021-06-05     05:08          17635 services

PS C:\Users\David>

Details

Terminal (Power Shell) or Power Shell (pwsh)

Click the drop down arrow at the terminal tabs and select git bash.

Get the git bash prompt, e.g.,

David@LimeDevB MINGW64 ~
$

David@LimeDevB MINGW64 ~ $


 - If the problem was occurring with a specific repository, can you provide the
   URL to that repository to help us with testing?

not applicable
dscho commented 1 month ago
ln: failed to create symbolic link '/etc/mtab': No such file or directory
'C:\WINDOWS\system32\drivers\etc\hosts' -> '/etc/hosts'
/usr/bin/cp: cannot create regular file '/etc/hosts': No such file or directory
'C:\WINDOWS\system32\drivers\etc\protocol' -> '/etc/protocols'
/usr/bin/cp: cannot create regular file '/etc/protocols': No such file or directory
'C:\WINDOWS\system32\drivers\etc\services' -> '/etc/services'
/usr/bin/cp: cannot create regular file '/etc/services': No such file or directory
'C:\WINDOWS\system32\drivers\etc\networks' -> '/etc/networks'
/usr/bin/cp: cannot create regular file '/etc/networks': No such file or directory
rm: cannot remove '/etc/post-install/01-devices.post': Permission denied
rm: cannot remove '/etc/post-install/03-mtab.post': Permission denied
rm: cannot remove '/etc/post-install/06-windows-files.post': Permission denied
rm: cannot remove '/etc/post-install/99-post-install-cleanup.post': Permission denied

This means that the post-install stage of the installer failed. You may need to run Git Bash once in elevated mode to fix this.

ATECoder commented 1 month ago

I ran Git Bash with elevated mode. This fixed Git Bash but did not fix opening the Git Bash terminal tab from Terminal.

I will reinstall Git into Program Files as suggested in issue #4971.

ATECoder commented 1 month ago

Installing to c:\program files\git addresses this issue.

Note, though, that the uninstaller left orphan entries in the registry. Consequently, running bash from the File Explorer shell context menu fails with a program not found error.

dscho commented 1 month ago

the uninstaller left orphan entries in the registry.

It would be quite helpful to fill in the missing blanks, i.e. to list the exact entries that have been left installed. There is specific code defining what registry items the uninstaller should remove.

ATECoder commented 1 month ago

... indeed. i did go through the registry, which took a bit of time and should have exported all these items. next time.

dscho commented 1 month ago

This fixed Git Bash but did not fix opening the Git Bash terminal tab from Terminal.

That's strange, as we specifically adjust the path in the Windows Terminal profile.

ATECoder commented 1 month ago

I have a similar install on another VM which I could use to explore these issues.

However, my take, at this point, is that installing to folders other than program files is not recommended and that the effort required to fixing the issues that such installs brings about is not worth your or my time as there are other more important tasks ahead.

Please accept my thanks and gratitude for the work you guys are doing. Over the years, I have experimented with a few version control systems. GIT has been the only one I could master enough to keep my code in some control.

Clearly, it takes a village.

David

dscho commented 1 month ago

@ATECoder shall we close the ticket, then?