Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git gives invalid path issue while switching between branches

Tags:

git

github

i have cloned the project in my windows machine(windows 10) and try to switch to different branch. but getting invalid path issue[1]

#git switch develop

[1]

error: invalid path 'src/main/resources/examples/invoice-item-create-request-eip.json '
error: invalid path 'src/main/resources/examples/invoice-item-create-request-orcl.json '

Why is that? I didn't get any issue /warning when i clone the project

like image 967
Ratha Avatar asked Mar 30 '26 21:03

Ratha


1 Answers

I didn't get any issue /warning when i clone the project

Probably because the default checked out master branch did not include files with a trailing space in it.

See if you can rename those files directly on GitHub in the develop branch (through their web GUI interface), and then clone the repository again (and switch to develop)

If you cannot rename them, exclude them through a sparse checkout (new command, still experimental with Git 2.25: I present it here).


As noted by wdtj in the comments:

if you are using sparse-checkout on Windows, you may need to add git config core.protectNTFS false per git-for-windows/git issue 2777

like image 197
VonC Avatar answered Apr 02 '26 12:04

VonC