Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git Bash Sets USERNAME Instead of USER #1878

Closed
1 task done
jcburley opened this issue Oct 12, 2018 · 5 comments
Closed
1 task done

Git Bash Sets USERNAME Instead of USER #1878

jcburley opened this issue Oct 12, 2018 · 5 comments

Comments

@jcburley
Copy link

jcburley commented Oct 12, 2018

  • 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.16.0.windows.2
cpu: x86_64
built from commit: a56c4f9e2a9513d2be57dc4346e0e84887399cd9
sizeof-long: 4
$ bash --version
GNU bash, version 4.4.12(2)-release (x86_64-pc-msys)
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
  • Windows 7 64-bit
$ cmd.exe /c ver

Microsoft Windows [Version 6.1.7601]
  • 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: Nano
Path Option: BashOnly
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

No idea, other than I've got my own .bash_profile and similar files.

Details

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

Bash

Pressed Windows button, typed "bash", it selected "Git Bash", hit Enter, got Git Bash window.

  • What did you expect to occur after running these commands?

An environment with $USER set to my username.

  • What actually happened instead?

An environment with $USERNAME set to my username.

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

Unsure of source; installed this awhile back.

@jcburley
Copy link
Author

(Note that I'm not sure this Git repo is the proper place to report Git Bash issues, as I couldn't find the Git Bash emulation code after looking around awhile....)

@PhilipOakley
Copy link

Hi @jcburley The Git for Windows bash is provided as a minimalist convenience capability to allow us to run the regular Git commands and test suite. It does not attempt to emulate a full Linux environment so only sets the most limited number of environment variables needed. (there is always WSL for a larger experience)

The bash is borrowed from MSYS2. The Git for Windows FAQ, part of our wiki, is a good place to start for some of these nuances, and maybe to add clarifications where needed. Contributions are welcome.

Also have a look at https://github.com/git-for-windows/git/wiki/Building-msys2-runtime

@dscho
Copy link
Member

dscho commented Nov 28, 2018

Even if it looks a little bit like Unix/Linux, Git Bash does not magically turn your Windows into a Unix. Therefore, the USERNAME environment variable is set, as is common on Windows, not the USER variable. Likewise, you will note the absence of the UID variable.

If you must have those, then you can set them yourself in ~/.bash_profile, I would think.

In any case, this is definitely not a bug or a problem in Git, so I am closing this.

@dscho dscho closed this as completed Nov 28, 2018
@jcburley
Copy link
Author

Okay, that makes sense, thanks! (And I do indeed work around this in my ~/.bash_profile.)

@jcburley
Copy link
Author

(But Git Bash is fairly magical IMO. ;) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants