How to use Windows network paths with Git Bash

WindowsPathGit Bash

Windows Problem Overview


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?

Windows Solutions


Solution 1 - Windows

Actually just cd //servername/share/path/to/folder where //servername/ is followed by at least one shared folder.

Solution 2 - Windows

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, e.g. 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

Solution 3 - Windows

Actually

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

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

Solution 4 - Windows

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

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

Notice the word file and 4 slashes after it, that is the trick. [1]: https://stackoverflow.com/questions/2519933/git-clone-repo-across-local-file-system-in-windows

Solution 5 - Windows

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.

enter image description here

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFlorian von StoschView Question on Stackoverflow
Solution 1 - WindowsprotometaView Answer on Stackoverflow
Solution 2 - WindowsFlorian von StoschView Answer on Stackoverflow
Solution 3 - WindowsAjasjaView Answer on Stackoverflow
Solution 4 - Windowsi--View Answer on Stackoverflow
Solution 5 - Windows027View Answer on Stackoverflow