GitHub doesn't handle spaces at the end of filenames well

I just tried to clone a repository with spaces at the ends of some of the filenames. (example file:

Unsuprisingly Git itself isn’t too happy about this and refuses to clone on my Windows machine. In order to fix the issue, I tried to make the edits through the GitHub interface itself before cloning. However, the filename box at the top here seems to automatically strip spaces from the filename:


Of course, the result of that is that you cannot make a commit to just remove the space character - since GitHub’s UI has already removed it and doesn’t think you’ve made any changes at all. In order to fix the issue, I first had to rename the file to something different, then back to the corrected name. Would be great if this UI issue could be fixed.

Hi @rossng :wave: and welcome back to the community!

This issue has been reported to our engineering team. I was able to confirm that this behavior persists through testing. I was able to clone the repository to my Mac, but ran into trouble on my Windows machine.

For now, the only workaround is the one you have illustrated here by changing the file name. It’s clearly quite a cumbersome workaround, even if you only have a few files.

I can’t say when or if this will be addressed, but you can keep an eye on this thread for future updates as well as our Changelog .

Thanks Ernest! Appreciate that you took the time to reproduce the issue.

1 Like