Truly Portable Git

I'm trying to create a fully portable version of git on a USB drive with its own SSH keys, and I want it to work no matter how drive letter windows do it. I installed portable git and most of them work. The problem I am asking is to set $HOME as dynamic, I want it to point to /DRIVELETTER/PortableApps/PortableGit , so when I create and use my SSH keys, it will go to /DRIVELETTER/PortableApps/PortableGit/.ssh/

Right now, $HOME is / , and it makes the default path to generate ssh //.ssh/id_rsa , which does not exist. I found a site that says "SET IT TO /e/bla/bla/bla/ ", but this does not work if the drive letter is J

I have not found good guides for setting up truly portable git.

Thanks for any help Munchies

+6
source share
1 answer

In a batch file, first do

 for /F "delims=\: usebackq" %%i in (`cd`) do SET USB_DRIVE=%%i 

then the remaining time (in batch files) use %USB_DRIVE% instead of d: or whatever it is.

+3
source

Source: https://habr.com/ru/post/915336/


All Articles