简体   繁体   中英

Git on Windows: could not create leading directories error

I have installed MsysGit on Windows. The following command invoked from the cmd.exe command-line gives error:

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 Bash works fine.

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.

don't use single quotes on windows cmd. Use double quotes for paths with spaces, or no quotes at all when no spaces exist.

In your case, no spaces are in the path, so no quotes are necessary.

Eg

C:\path\no\spaces               // ok
"C:\Program Files\Some Spaces"  // ok
'C:\Program Files\Foo'          // wrong.

Please refer to this issue in github of vunble.

https://github.com/gmarik/vundle/issues/283

The solution is very simple, just comment the line of shellslash with '"'

Best wishes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM