Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the location of /tmp in a Windows install of Git Bash

the TMP/TEMP directory in Windows 10 usually points to C:\Users\<user>\AppData\Local\Temp. When using Git bash, the /tmp directory "magically" refers to that location, too.

How can I change this behavior upon startup of the Git bash such that TMP, TEMP (for Windows programs started by Git bash) and the /tmp location refer to a different directory, e.g. C:/myTemp?

(Changing TMP or TEMP globally in Windows is not a viable option for me...)

like image 762
chris_f Avatar asked Nov 07 '25 01:11

chris_f


1 Answers

In /etc/fstab, comment out any existing lines defining /tmp, and add this one:

C:/myTemp /tmp ntfs auto

The ntfs part doesn't matter because the system figures out the filesystem on its own. The auto part tells the system to mount it automatically when you start your shell. There are other options you might want to specify, like case sensitivity. For more information about that file, see:

https://cygwin.com/cygwin-ug-net/using.html#mount-table

After editing that file, you'll need to open a new shell.

like image 195
David Grayson Avatar answered Nov 09 '25 17:11

David Grayson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!