How to stage the files to the local git repository where file names has space in them?

46 Views Asked by At

I have 2 files locally: File 1.txt and File 2.txt.

When I stage the files with the command git add File 2.txt, it is giving me the below error:

fatal: pathspec 'File' did not match any files

git stage file error

1

There are 1 best solutions below

0
Jashua Criss On BEST ANSWER

I solved myself by referring the article in Noble desktop Blog.

The answer is:

If the file name/path has a space, wrap it in quotes(Single/double).

Command:

git add 'File 2.txt'