Deleted files in a freshly cloned git repo

The other day someone emailed me and told me that they tried to clone the HTMHell repo, but they only got an empty folder (except for the hidden .git folder), and all files were deleted as if they cloned the repo and immediately moved all files into the trash.

I couldn’t reproduce the issue on my Mac, but I had the same problem on my Windows machine. This post on StackOverflow suggested that it was related to using forbidden characters in file names.

Forbidden characters in file names on Windows:

  • < (less than)
  • > (greater than)
  • : (colon)
  • ” (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • &ast; (asterisk)

I reviewed the files and found an image named 30-bullet-“list”.png. I have a node script that automatically creates the social media preview images for blog posts and uses the title as the file name. I forgot to take care of special characters.

I tweaked the script and renamed the file, and – voilà – cloning now works as expected on Windows.

Edit: Tane added on social media that he had an issue raised once on one of his repos because he was using an emoji in a filename and it broke on OSX.

Conclusion: Don’t use special characters, spaces, or emojis in your file names.

My blog doesn’t support comments yet, but you can reply via blog@matuzo.at.


This content originally appeared on Manuel Matuzović - Blog and was authored by Manuel Matuzović

The other day someone emailed me and told me that they tried to clone the HTMHell repo, but they only got an empty folder (except for the hidden .git folder), and all files were deleted as if they cloned the repo and immediately moved all files into the trash.

I couldn't reproduce the issue on my Mac, but I had the same problem on my Windows machine. This post on StackOverflow suggested that it was related to using forbidden characters in file names.

Forbidden characters in file names on Windows:

  • < (less than)
  • > (greater than)
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)

I reviewed the files and found an image named 30-bullet-"list".png. I have a node script that automatically creates the social media preview images for blog posts and uses the title as the file name. I forgot to take care of special characters.

I tweaked the script and renamed the file, and – voilà – cloning now works as expected on Windows.

Edit: Tane added on social media that he had an issue raised once on one of his repos because he was using an emoji in a filename and it broke on OSX.

Conclusion: Don't use special characters, spaces, or emojis in your file names.

My blog doesn't support comments yet, but you can reply via blog@matuzo.at.


This content originally appeared on Manuel Matuzović - Blog and was authored by Manuel Matuzović


Print Share Comment Cite Upload Translate Updates
APA

Manuel Matuzović | Sciencx (2023-05-29T00:00:00+00:00) Deleted files in a freshly cloned git repo. Retrieved from https://www.scien.cx/2023/05/29/deleted-files-in-a-freshly-cloned-git-repo-2/

MLA
" » Deleted files in a freshly cloned git repo." Manuel Matuzović | Sciencx - Monday May 29, 2023, https://www.scien.cx/2023/05/29/deleted-files-in-a-freshly-cloned-git-repo-2/
HARVARD
Manuel Matuzović | Sciencx Monday May 29, 2023 » Deleted files in a freshly cloned git repo., viewed ,<https://www.scien.cx/2023/05/29/deleted-files-in-a-freshly-cloned-git-repo-2/>
VANCOUVER
Manuel Matuzović | Sciencx - » Deleted files in a freshly cloned git repo. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/05/29/deleted-files-in-a-freshly-cloned-git-repo-2/
CHICAGO
" » Deleted files in a freshly cloned git repo." Manuel Matuzović | Sciencx - Accessed . https://www.scien.cx/2023/05/29/deleted-files-in-a-freshly-cloned-git-repo-2/
IEEE
" » Deleted files in a freshly cloned git repo." Manuel Matuzović | Sciencx [Online]. Available: https://www.scien.cx/2023/05/29/deleted-files-in-a-freshly-cloned-git-repo-2/. [Accessed: ]
rf:citation
» Deleted files in a freshly cloned git repo | Manuel Matuzović | Sciencx | https://www.scien.cx/2023/05/29/deleted-files-in-a-freshly-cloned-git-repo-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.