xehpuk
xehpuk

Reputation: 8241

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.

Upvotes: 4

Views: 10917

Answers (2)

selyunin
selyunin

Reputation: 1630

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

Upvotes: 8

CodeWizard
CodeWizard

Reputation: 142024

The problem is very simple to fix:

You simply need to set an HOME variable under your system properties in windows and set the home to your local user-profile folder

enter image description here

Upvotes: 0

Related Questions