[英]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. Windows中使用\\\\servername\\share\\path\\to\\folder
语法表示网络资源的\\\\servername\\share\\path\\to\\folder
。 How does one use such a folder within Git Bash, which uses Unix-style paths? 如何在使用Unix风格路径的Git Bash中使用这样的文件夹?
实际上只是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: 为此,请在Windows cmd
shell中执行以下命令:
pushd \\servername\share\path\to\folder
The next prompt will carry the assigned drive letter, eg Z:\\path\\to\\folder
. 下一个提示将携带指定的驱动器号,例如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: 现在,打开Git Bash(它不能用于已经运行的实例)并转到新创建的驱动器号:
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
) 对我来说很好用(使用git version 1.9.0.msysgit.0
)
No need to type the path manually. 无需手动键入路径。 Just right click! 只需右击! on your repository and click Git Bash option. 在您的存储库上,单击Git Bash选项。 It will open the git bash with your repository path. 它将使用您的存储库路径打开git bash。
Also i suggest to use Mp Network Drive option of windows to map the network location as a drive and use it only. 此外,我建议使用Windows的Mp网络驱动器选项将网络位置映射为驱动器,并仅使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.