forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
git-bash.exe saves/loads config from wrong home-directory (When using 'run as') #2709
Copy link
Copy link
Closed
Milestone
Description
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
- What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
**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-
.gitconfigshould be loaded from "c:\Users\MY_USER"
-
What actually happened instead?
- Git bash tried to save in the dir
c:\windows\system32what is not writeable as non-admin. - my $HOME
/c/Windows/system32 - no user-
.gitconfigwas loaded (is assume because it was looking inc:\windows\system32for a.gitconfigwhich doesn`t exist
- Git bash tried to save in the dir
-
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
- I tried to manually set the HOME in first line of
GIT_INSTALL_DIR\etc\profiletoHOME="$(cygpath -u "$USERPROFILE")"Like suggested in https://stackoverflow.com/a/32233667/2377961- that results in:
- a correct
HOME- Variable, but git-bash still loads and saves config from the wrong directory - that users
.gitconfigwas loaded from "c:\Users\MY_USER" like expected - BUT git-bash.exe still loads and saves its config options from/to
c:\windows\system32
- a correct
- that results in:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels