如何在 Git Bash 中使用 Windows 网络路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20047892/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use Windows network paths with Git Bash
提问by Florian von Stosch
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 中用\\servername\share\path\to\folder
语法表示。如何在使用 Unix 样式路径的 Git Bash 中使用这样的文件夹?
回答by protometa
Actually just cd //servername/share/path/to/folder
where //servername/
is followed by at least one shared folder.
实际上只是cd //servername/share/path/to/folder
where//servername/
后跟至少一个共享文件夹。
回答by Florian von Stosch
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, 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:
下一个提示将携带分配的驱动器号,例如Z:\path\to\folder
。现在,打开 Git Bash(它不适用于已经运行的实例)并转到新创建的驱动器号:
cd Z:/path/to/folder
or equally
或同样
cd /z/path/to/folder
回答by Ajasja
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
)
回答by i--
回答by 027
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.
无需手动输入路径。只需右键单击!在您的存储库上,然后单击 Git Bash 选项。它将使用您的存储库路径打开 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 Network Drive 选项将网络位置映射为驱动器并仅使用它。