4

I'm trying to use Git Add command to stage a couple of files for committing later. However, I can't seem to add it because Git bash doesn't like a directory with spaces in it. How can get around this issue?

I'm using Win 7 OS. My command looks like the one below:

git add folder1/folder2/new folder/folder3/myFile.txt

The error that I'm getting is the following: new: No such file or directory

Thanks!

  • Have you tried quoting the filename and path? git add "folder1/folder2/new folder/folder3/myFile.txt" – killermist Jan 28 '15 at 15:55
  • Yes, that was just what James suggested. And it works great. I had no idea you can even do that. haha – SpartaSixZero Jan 28 '15 at 15:56
9

You should be able to get around this problem if you put the path in quotes:

git add "folder1/folder2/new folder/folder3/myFile.txt"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.