简体   繁体   中英

How to use Windows network paths with Git Bash

Paths to network resources are denoted in Windows with the \\\\servername\\share\\path\\to\\folder syntax. How does one use such a folder within Git Bash, which uses Unix-style paths?

实际上只是cd //servername/share/path/to/folder其中//servername/后面跟着至少一个共享文件夹。

You need to associate a drive letter to the network path you want to use. To do this, execute the following command in the Windows cmd shell:

pushd \\servername\share\path\to\folder

The next prompt will carry the assigned drive letter, eg Z:\\path\\to\\folder . Now, open Git Bash (it will not work with an already running instance) and go to the new created drive letter:

cd Z:/path/to/folder

or equally

cd /z/path/to/folder

Actually

git clone //servername/path/to/repo.git

works fine for me (using git version 1.9.0.msysgit.0 )

If you need it for cloning, more appropriate answer is here :

git clone file:////<host>/<share>/<path>

Notice the word file and 4 slashes after it, that is the trick.

No need to type the path manually. Just right click! on your repository and click Git Bash option. It will open the git bash with your repository path.

在此输入图像描述

Also i suggest to use Mp Network Drive option of windows to map the network location as a drive and use it only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM