I have the same issue like Git for Windows doesn't execute my .bashrc file and tried to make the same steps. But my Git Bash (2.5.0, 64bit on Windows 7, 64bit) doesn't know my %USERPROFILE%
.
pitgrap@xxx MINGW64 /
$ pwd
/
pitgrap@xxx MINGW64 /
$ cd ~
bash: cd: /%USERPROFILE%: No such file or directory
If I run Git Bash as Administror, it works. :( But I don't want to run it everytime as Administrator. Any ideas?
The new Git-for-Windows is using a %HOME%
enviroment variable. It was set on my machine to HOME=%USERPROFILE%
. You can't use another variable here. Remove it or change it to a real path.
See also https://github.com/git-for-windows/git/issues/313
This just has to do with how each of those different languages handle variable expansion.
cmd: C:\> echo %USERPROFILE%
bash: $ echo $USERPROFILE
ps: PS> echo $env:USERPROFILE
In windows cmd prompt, variables should be surrounded by %
on either side
Whereas Bash and PowerShell indicate a variables by prefixing with a $
.
Git Bash gets all existing Windows environment variables at startup, while powershell tries to limit polluting the global namespace by including them under the $env
object
If you want to confirm the shell has access to the environment variable, you can list all variables:
cmd (docs): C:\> SET
bash (docs): $ printenv
ps (docs): PS> Get-ChildItem env:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With