How to use Windows network paths with Git Bash

元气小坏坏 提交于 2019-12-03 05:21:57

问题


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?


回答1:


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




回答2:


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



回答3:


Actually

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

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




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/20047892/how-to-use-windows-network-paths-with-git-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!