Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:36:28+00:00 2026-05-16T06:36:28+00:00

I have successfully installed and configured msysGit Portable on my flash drive, and have

  • 0

I have successfully installed and configured msysGit Portable on my flash drive, and have used it to pull and push GitHub repos. However, I seem to always have to kludge the SSH support.

Specifically, in order for SSH to find my key files, I have to follow these instructions to start a second instance of ssh-agent and then ssh-add my key every time I run git-bash.bat.

Using the output of ssh -v git@github.com to debug I see that msysGit defaults to my Windows user directory to look for keys. It can’t do that; I need it to look in its own directory on the portable drive.

How can I force $HOME to be the program’s own folder?

Update for broken Vox link

Instructions from this page are similar to the now-broken link I originally posted. Quoted below. Also here’s the webarchive of original Vox article.

However, if you try this and get:

% ssh-add
Could not open a connection to your authentication agent. 

then your session is not running under the ssh-agent. You can get around this by restarting a new shell under the agent by running:

exec ssh-agent bash 

where you can replace bash with the shell of your choice. Once you do this, you should be able to run ssh-add to load your key for that shell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:36:29+00:00Added an answer on May 16, 2026 at 6:36 am

    The command used to launch git bash is:

    C:\Windows\SysWOW64\cmd.exe /c ""C:\Prog\Git\1.7.1\bin\sh.exe" --login -i"
    

    I just tried the following in a DOS session:

    C:\>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
    

    By default, $HOME$%HOMEPATH%, but if I force %HOME%:

    set HOME=/another/path
    

    and then launch the same bash session:

    C:\>C:\Windows\SysWOW64\cmd.exe /c ""C:\Prog\Git\1.7.1\bin\sh.exe" --login -i"
    VonC@XXX /c/
    $ echo $HOME
    /another/path
    

    So if you wrap the bash call by a script setting the HOME to:

    • %~dp0 : the path of the wrapper on your USB key
    • or %~d1\your\path: with %~d1 being the drive letter (of your usb key if your wrapper is on it)

    , you should be able to force HOME to whatever value you need.


    Note (November 2011): since then, the OP dgw has written his own wrapper:

    git-bash-portable.bat:

    @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
    

    The article "Portable Git for Windows: setting the $HOME environment variable to allow complete portability (including SSL keys and configuration for use with GitHub)" also add useful information.

    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.

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully installed & configured the M2E Maven plugin for Eclipse, along with
We have WFF 2.5 installed, and have used it to successfully configure a farm
I have installed (on Linux) and configured CDT successfully and now I need to
I have successfully installed and configured gitosis on an Ubuntu server. We're currently just
I have successfully installed Oracle 11g R2 version. I don't have good knowledge about
I have just successfully installed CakePHP and I see that I can edit the
I have successfully built and installed gcc 4.6.1 on my OS X box, but
I have successfully installed Titanium Studio. SDK Version:1.7.5 .Now I have downloaded Android SDK
I have deployed CRM and installed the reporting extensions component successfully on the SSRS
I have successfully installed an EAV attribute by doing $installer->addAttribute('order', 'field', etc) . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.