Search code examples
gitgithubmingw-w64

Git default home directory includes a typo, how can I change it?


When I first open git bash my $HOME is set to "/c/Users/ds420%", however there is no % in the actual directory so when directories are supposed to be created automatically I get an error, for example:

$ ssh -T git@github.com
Could not create directory '/c/Users/ds420%/.ssh'.
percent_expand: unknown key %/

and even

$ cd ~
bash: cd: /c/Users/ds420%: No such file or directory

I have tried HOME=/c/Users/ds420 and that fixes the second code snippet but it doesn't seem to have an effect on what Git thinks HOME is. I also tried setting GIT_DIR and XDG_CONFIG_HOME based on similar stack overflow problems, none of those helped.

Is there a way to either input HOME to the ssh function or to change it more permanently? Can anyone tell me why the % might have appeared in the first place?


Solution

  • change the $HOME environment variable to your user home. To do this automatically when git bash is started run the following command:

    $ echo "HOME=\"YourHomeDir\"" > .bashrc
    

    replace YourHomeDir with /c/Users/your_windows_username