Cassidy Williams

Software Engineer in Chicago

Cassidy's face

Renaming a folder on the GitHub website

I ran into an issue recently where I had started a git repository while working on my Mac, and made a folder with a question mark (?) in it.

That is a valid folder name on Mac, but not on Windows, so when I tried to clone the repository onto my WIndows PC later, the clone kept failing because of the folder name!

error: invalid path '<funky file name here>'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

So, I had to figure out a solution to rename my folder from the GitHub website, from my PC. It’s not as intuitive as renaming a file, but I found a couple very easy options!

Edit it from the filename editor

Did you know you can add and delete folders from the filename editor itself on GitHub? I didn’t, but there’s a nice blog post on the subject from 2013 here.

So, in my case, I could go into a file inside the folder in question, hit the button to edit the file, and then update the folder name using this method.

Change the name using the GitHub web-based editor

When you’re in any GitHub repository, you can hit the period (.) key and it will open the GitHub web editor! You can also do this by changing to in the URL.

When you do that, a VSCode-like editor will open, allowing you to edit folders and files to your heart’s content! In my particular case, I was able to edit my folder in the web editor, then use the git extension in the editor to commit the change with one click.

It’s done!

Now I can clone my no-longer-weirdly-named folder onto my Windows PC with no issues! Yee haw!

View posts by tag

#advice #events #technical #learning #musings #work #meta #personal