'Git - Illegal characters in path git visual studio 2019

I'm working on Xamarin.Forms project and I'm in the master branch and I'm trying to check out another branch but I'm getting this error in VS 2019:

enter image description here

& I'm getting this error when using commands: enter image description here

Notes:

  • This is my first time checking out this branch
  • I can check out other branches normally
  • The paths mentioned in the error don't exist.
  • I don't care about the ios application for this project, I focus on the Android one.

What should I do to fix this error and check out the branch successfully?



Solution 1:[1]

In command line, try and set a sparse checkout clone first, then open the IDE for your Xamarin project:

git clone --filter=blob:none --no-checkout https://github.com/remote/project
cd project
git sparse-checkout set /* !/.vs/JM?/xs/project-cache
git sparse-checkout init
# that sets git config core.sparseCheckoutCone true
git read-tree -mu HEAD

The idea is to ignore the content of .vs/JM?/xs/project-cache (assuming .vs is right under the root folder of the repository) on checkout (of any branch).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC