开发者

How to register newly mounted drive in git bash?

In my day-to-day work (I'm using MS Windows), I keep my git bash (actually using console2 for this) open for the whole day. It is also very frequent that I mount new drives that I would like to work with git. However I noticed that I need to exit the bash and open it again in order to make it recognize new drive letter.

Is there any command that 'registers' already mounted drive in git bash ? thanks

edit2: I do开发者_StackOverflow not have any option to left a comment under my own question (weird ..?), so I post it here:

$ mount -a
sh.exe": mount: command not found


Couple of things, had some difficulty finding sources so feel free to take it with a grain of salt.

  1. Msysgit simply doesn't include a version of mount. It is my understanding that cygwin does, however. There is no simple way to either view all attached drives or mount a new drive in msys, and thus Git Bash.

To answer your question, you don't: Git Bash does not dynamically assign drives, so if you mount new drives, you need to close all instances and restart Git Bash (source). The source referenced there is cached here. Sorry there's not a nicer solution.


I commonly mount a drive to the file system and then have to run a script that alters some files on the from within a Git Bash session in Console 2.

If you mount something to a given drive letter, say F: on the Windows file system, and then start the Git Bash session it will have it mapped. I can mount/unmount the F: drive and the session can still access /f/ without any issues. So, mount all the drives you will typically need to hit and then start the session and hopefully you don't need to restart your Git Bash too often.


I find that if I exit all currently running git bash sessions and then launch a new one, then I can access the new drive, e.g. X:, in the new bash session under /x/.

Even launching a new git bash session is not enough if there was already one running; I must exit the previous git bash sessions and then launch one for it to make the new drive letters available.


I found that if I set

MSYS_WATCH_FSTAB=YesPlease

in my User Environment variables. Then everything worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜