This solution works fine until you update Git for Windows Portable (as I did when I upgraded to PortableGit-1.9.4-preview20140929), at which point $HOME will change back to your %USERPROFILE% directory. The reason is because when you unzip the files from the new version into the current installation directory, the ‘profile’ file will be overwritten and revert back to the default settings. Here’s what I did to work around this and make my Git for Windows installation portable even after repeated updates (let’s assume my installation directory is also E:\Git):
1. Move the E:\Git\etc\profile file to E:\Git\home\tom
2. Edit E:\Git\home\tom\profile; you can add the line as shown in this article, but I chose to do this:
Change…
# Set up USER's home directory if [ -z "$HOME" -o ! -d "$HOME" ]; then HOME="$HOMEDRIVE$HOMEPATH" if [ -z "$HOME" -o ! -d "$HOME" ]; then HOME="$USERPROFILE" fi fi
To…
if [ -z "$HOME" -o ! -d "$HOME" ]; then HOME="/home/tom" fi
3. Make a symbolic link E:\Git\etc\profile pointing to E:\Git\home\tom\profile (I used Link Shell Extension)
4. Make the E:\Git\home\tom\profile file read-only
Now whenever I update Git for Windows Portable, I just unzip all files to E:\Git and select to overwrite everything. When Windows tries to overwrite ‘profile’ you’ll get a prompt saying “You need permission to perform this action”; select ‘Skip’ and you’re good to go.









