Skip to content

git-bash.exe saves/loads config from wrong home-directory (When using 'run as') #2709

@Radon8472

Description

@Radon8472
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.24.1.windows.2
cpu: x86_64
built from commit: 992f0773022527b1b0cb1e0c13aec97dd5248053
sizeof-long: 4
sizeof-size_t: 8

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
    • Windows 10 - 64 Bit
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.18362.900]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# 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"
$ cat /etc/install-options.txt

Editor Option: CustomEditor
Custom Editor Path: C:\Windows\System32\notepad.exe
Path Option: BashOnly
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
Enable Builtin Interactive Add: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

In the administrative users, everything is fine, in the "non-admin" causes problems.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

git-bash

**I started the git-bash like this:**
- Open `cmd` using "Run as user"
- Enter Credentials of an NON-Administrative user
- run `git-bash`
- right-click (on git-bash-title bar) -> options
- change some options
- hit "save" button
  • What did you expect to occur after running these commands?

    • I expect it should load/save the config in my users home-dir (c:\Users\MY_USER.minttyrc)
    • I expect $HOME should be HOME=/c/Users/MY_USER
    • I expect user-.gitconfig should be loaded from "c:\Users\MY_USER"
  • What actually happened instead?

    • Git bash tried to save in the dir c:\windows\system32 what is not writeable as non-admin.
    • my $HOME /c/Windows/system32
    • no user-.gitconfig was loaded (is assume because it was looking in c:\windows\system32 for a .gitconfig which doesn`t exist
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

More Details:

my relevant env variables in the console BEFORE Starting git bash are

APPDATA=C:\Users\MY_USER\AppData\Roaming
HOMEDRIVE=C:
HOMEPATH=\Windows\system32
LOCALAPPDATA=C:\Users\MY_USER\AppData\Local
TEMP=C:\Users\MY_USER\AppData\Local\Temp
TMP=C:\Users\MY_USER\AppData\Local\Temp
USERNAME=MY_USER
USERPROFILE=C:\Users\MY_USER

In the git-bash env shows:

USERNAME=MY_USER
LOCALAPPDATA=C:\Users\MY_USER\AppData\Local
USERPROFILE=C:\Users\MY_USER
APPDATA=C:\Users\MY_USER\AppData\Roaming
HOME=/c/Windows/system32
HOMEPATH=\Windows\system32

So all variables are correct, only HOME and HOMEPATH are wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions