Fixed: Github – Unable to Checkout Working Tree on Windows after Mac Edits
I grabbed my coffee and headed to my Windows laptop. The first thing I did was a Github checkout of a project I had worked on the evening before on my Mac. The last thing I wanted to be faced with was the following message; Error: invalid Path ‘BP07:AI Writer Research /Data Story Telling.md’ and Fatal: unable to check out working tree. Wild error but an easy solution, let me explain.
My Scenario:
This was a bit of a head-scratcher, but I was working on a project and did a checkout in VSCode on a Mac. After checking back in, I tried to check out but could not on a Windows 10 machine. That was when the error showed up. Frustrated, I went back to my Mac and was able to check out, make changes and check back in. Tried on the windows machine, and the same error.
The Problem & Solution:
The problem, which I missed when looking at the error message, is that there is a space at the end of the directory I created while on my Mac. Microsoft Windows does not allow spaces at the end of a directory name. The path in the repository could not be created in the environment that I was cloning or even checking out. This can be caused by working on multiple platforms where rules are different.
I tried to create a directory on Windows with a trailing space and looked to accept it, but the space was removed automatically. DOH… So, when creating directories on a Mac, ensure you don’t accidentally create a directory with a training space.
I hope this helps!!!!!!