git-for-windows / git

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

git bash forcing incorrect HOME env #5137

Open ikiris opened 1 week ago

ikiris commented 1 week ago

Setup

$ git --version --build-options

git version 2.46.0.windows.1
cpu: x86_64
built from commit: 2e6a859ffc0471f60f79c1256f766042b0d5d17d
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.9.0
OpenSSL: OpenSSL 3.2.2 4 Jun 2024
zlib: 1.3.1
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.19045.4894]
(c) Microsoft Corporation. All rights reserved.
# 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: VisualStudioCode
Custom Editor Path:
Default Branch Option: main
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Git Pull Behavior Option: FFOnly
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Enabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled

env (as seen by git-bash): MSYSTEM=MINGW64 PATH= SYSTEMDRIVE=C: SYSTEMROOT=C:\WINDOWS WINDIR=C:\WINDOWS TERM=xterm-256color HOME=/home/ikiris

Details

any

something has caused git bash to start forcing the HOME env to /home/$USERNAME instead of what it should be at /c/Users/username, and I cannot for the life of me find what is causing it other than just an update broke things at some point. this worked previously.

i can't find an override in any of the profile files etc, and even forcing via export in session cannot override it. i've tried switching the nssswitch value to windows as well as forcing HOME env via windows.

you can see my real shell envs here from powershell:

ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\ikiris\AppData\Roaming ChocolateyInstall=C:\ProgramData\chocolatey ChocolateyLastPathUpdate=133370443822771631 COMMONPROGRAMFILES=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=FEAR COMSPEC=C:\WINDOWS\system32\cmd.exe DriverData=C:\Windows\System32\Drivers\DriverData GOPATH=C:\Users\ikiris\go HOME=/c/Users/ikiris HOMEDRIVE=C: HOMEPATH=\Users\ikiris LOCALAPPDATA=C:\Users\ikiris\AppData\Local LOGONSERVER=\SORROW MSYS2_PATH_TYPE=inherit NUMBER_OF_PROCESSORS=8 OneDrive=C:\Users\ikiris\OneDrive OS=Windows_NT PATH=/c/Program Files/Python312/Scripts:/c/Program Files/Python312:/c/Program Files (x86)/VMware/VMware Player/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files/Microsoft VS Code/bin:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/ProgramData/chocolatey/bin:/c/Program Files/OpenSSH-Win64:/c/Program Files/dotnet:/c/Program Files/Graphviz/bin:/c/Program Files/Go/bin:/c/Program Files (x86)/WinSCP:/c/Program Files/TortoiseGit/bin:/c/Program Files/Docker/Docker/resources/bin:/c/Program Files/Git/cmd:/c/Users/ikiris/.cargo/bin:/c/WINDOWS/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps:/c/WINDOWS/system32/config/systemprofile/go/bin:/c/Program Files/Lens/resources/cli/bin:/ucrt64/bin:/usr/bin:/c/Users/ikiris/go/bin:/c/Users/ikiris/AppData/Local/Keybase PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.CPL PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=5e03 ProgramData=C:\ProgramData PROGRAMFILES=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\Intel\Wired Networking\ PUBLIC=C:\Users\Public SESSIONNAME=Console SSH_AGENT_PID=1551 SSH_AUTH_SOCK=C:/Users/ikiris/AppData/Local/Temp/ssh-pXhYgM4D6XcZ/agent.1550 SYSTEMDRIVE=C: SYSTEMROOT=C:\WINDOWS TEMP=/c/Users/ikiris/AppData/Local/Temp TMP=/c/Users/ikiris/AppData/Local/Temp USERDNSDOMAIN= USERDOMAIN= USERDOMAIN_ROAMINGPROFILE= USERNAME=ikiris USERPROFILE=C:\Users\ikiris VAULT_ADDR= WINDIR=C:\WINDOWS TERM=xterm-256color

dscho commented 1 week ago

You could try tracing the startup commands (similar to what is suggested on Git for Windows' wiki to diagnose performance issues).