Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Bash cannot resolve %userprofile%

I'm using Windows 8.1 Pro and Git 2.7.1.windows.2.

My problem is quite self-explanatory:

xehpuk@XEHPUK MINGW64 /d/the-next-big-thing (develop)
$ git pull
Could not create directory '/%userprofile%/.ssh'.
percent_expand: unknown key %/
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

xehpuk@XEHPUK MINGW64 /d/the-next-big-thing (develop)
$ cd ~
bash: cd: /%userprofile%: No such file or directory

xehpuk@XEHPUK MINGW64 /d/the-next-big-thing (develop)
$ echo $USERPROFILE
C:\Users\xehpuk

This worked a few days ago and I cannot remember changing anything on the system.

Obviously, I am a Git beginner and a primary Windows user, if that's important.


I have worked around the issue by setting the user environment variable GIT_SSH_COMMAND to "/c/Program Files/Git/usr/bin/ssh.exe" -i /c/Users/xehpuk/.ssh/id_rsa.

like image 638
xehpuk Avatar asked Sep 14 '25 08:09

xehpuk


1 Answers

September 2021, Git for Windows. I had the following error when trying to fetch sources from Jenkins:

stderr: vdollar_percent_expand: unknown key %U

To fix, set the environment variable HOME equals to %USERPROFILE%:

enter image description here

like image 144
selyunin Avatar answered Sep 17 '25 01:09

selyunin