Windows 上的 Git:无法创建前导目录错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4394806/
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
Git on Windows: could not create leading directories error
提问by Ashwin Nanjappa
I have installed MsysGiton Windows. The following command invoked from the cmd.exe command-line gives error:
我已经在 Windows 上安装了MsysGit。从 cmd.exe 命令行调用的以下命令给出错误:
C:\Users\joe>git clone 'git://github.com/MarcWeber/vim-addon-manager-known-repositories.git' 'C:/Users/joe/vim-addons/vim-addon-manager-known-repositories'
fatal: could not create leading directories of ''C:/Users/joe/vim-addons/vim-addon-manager-known-repositories'': Invalid argument
The same command issued in the command prompt of Git Bashworks fine.
在Git Bash的命令提示符中发出的相同命令工作正常。
What do I fix to make the normal command-line version work? This command is issued from within Vim, so I need it to work from cmd.exe.
我要修复什么才能使正常的命令行版本正常工作?这个命令是从 Vim 内部发出的,所以我需要它在 cmd.exe 中工作。
回答by Alex Budovski
don't use single quotes on windows cmd. Use double quotes for paths with spaces, or no quotes at all when no spaces exist.
不要在 windows cmd 上使用单引号。对带有空格的路径使用双引号,或者在不存在空格时根本不使用引号。
In your case, no spaces are in the path, so no quotes are necessary.
在您的情况下,路径中没有空格,因此不需要引号。
E.g.
例如
C:\path\no\spaces // ok
"C:\Program Files\Some Spaces" // ok
'C:\Program Files\Foo' // wrong.
回答by leo
Please refer to this issue in github of vunble.
请参考vunble的github中的这个issue。
https://github.com/gmarik/vundle/issues/283
https://github.com/gmarik/vundle/issues/283
The solution is very simple, just comment the line of shellslash with '"'
解决方法很简单,只用'"'注释shellslash行
Best wishes.
最好的祝愿。