Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The command used to launch git bash is:</p> <pre><code>C:\Windows\SysWOW64\cmd.exe /c ""C:\Prog\Git\1.7.1\bin\sh.exe" --login -i" </code></pre> <p>I just tried the following in a DOS session:</p> <pre><code>C:\&gt;C:\Windows\SysWOW64\cmd.exe /c ""C:\Prog\Git\1.7.1\bin\sh.exe" --login -i" VonC@XXX /c/ $ echo $HOME /c/Users/VonC </code></pre> <p>By default, $HOME$%HOMEPATH%, but if I force %HOME%:</p> <pre><code>set HOME=/another/path </code></pre> <p>and then launch the same bash session:</p> <pre><code>C:\&gt;C:\Windows\SysWOW64\cmd.exe /c ""C:\Prog\Git\1.7.1\bin\sh.exe" --login -i" VonC@XXX /c/ $ echo $HOME /another/path </code></pre> <p>So if you wrap the bash call by a script setting the HOME to:</p> <ul> <li><code>%~dp0</code> : the path of the wrapper on your USB key</li> <li>or <code>%~d1\your\path</code>: with <code>%~d1</code> being the drive letter (of your usb key if your wrapper is on it)</li> </ul> <p>, you should be able to force HOME to whatever value you need.</p> <hr> <p>Note (November 2011): since then, the <a href="https://stackoverflow.com/users/5991/dgw">OP dgw</a> has written his <a href="https://gist.github.com/533267" rel="nofollow noreferrer">own wrapper</a>:</p> <p><code>git-bash-portable.bat</code>:</p> <pre><code>@echo off rem Copyright (C): 2010 Voyagerfan5761 rem http://technobabbl.es/ set USERPROFILE=%~dp0 set HOMEDRIVE=%~d0 set HOMEPATH=%~p0 set HOME=%~dp0 set HISTFILE=%USERPROFILE%.bash_history rem set BASHRC=%USERPROFILE%.bashrc git-bash.bat </code></pre> <p>The article "<a href="http://markashleybell.com/portable-git-windows-setting-home-environment-variable.html" rel="nofollow noreferrer">Portable Git for Windows: setting the <code>$HOME</code> environment variable to allow complete portability (including SSL keys and configuration for use with GitHub)</a>" also add useful information.</p> <blockquote> <p>However, if you install Git on a portable drive, you'll want your settings to travel with the installation—which obviously they won't if it is looking for them in a folder which may not exist on other computers.</p> <p>So, what we need to do is tell Portable Git to treat a specific location within its own folder as the home folder; that way we can copy the whole Git folder anywhere we like and the settings will travel with it.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload