10

I am trying to checkout a repository with paths that have spaces. git clone/checkout failed. The following error is returned

fatal: cannot create directory at 'main-path/some-folder-with-space /another-folder': No such file or directory

Resolved by:

  1. Download project zip from github.
  2. Extract the project.
  3. git init
  4. git remote add origin git@github.com:MainRepo/project.git
  5. git fetch --all

Project is now successfully cloned to my windows machine. I can checkout the remote branches without any errors.

ariabele
  • 355
  • 1
  • 4
  • 9
  • 1
    checkout [this] (http://stackoverflow.com/questions/19180612/fatal-cannot-create-directory-at-root-wp-content-cache-page-enhanced-no-s) may help you – ntshetty Mar 13 '17 at 07:57
  • 2
    It seems Windows and NTFS doesn't handle spaces at the start or the end of a file or folder name rather well so I would try to avoid this. My attempts to reproduce a problem seems to indicate that Windows itself will silently strip away these spaces when creating the folder, and will silently ignore the spaces when attempting to access the folder **from .NET**, but not from other tools not based on .NET. – Lasse V. Karlsen Mar 13 '17 at 09:26

3 Answers3

1

Put the address in quotes

git clone "some/folder/with spaces/here.git"
DeaMon1
  • 572
  • 5
  • 10
0

Assuming you're on the command line, you can just escape spaces with \.

I tried with git clone ../some\ folder\ with\ spaces/.

EDIT: The target folder also contains spaces. No Problem. Can you elaborate on how you tried to clone? Are you using command line or some gui?

kowsky
  • 12,647
  • 2
  • 28
  • 41
0

This was resolved by using a lower version of Git Bash (1.9.5) I was using version 2.5.1 when I encountered this issue.

Rob
  • 26,989
  • 16
  • 82
  • 98
ariabele
  • 355
  • 1
  • 4
  • 9