Good Practices: Windows reserved words vs Git

Have you ever tried to clone/pull a repository in your local machine with git and you got this error?

fatal: cannot create directory at '<folder_name>/aux': Invalid argument

This is related to Windows reserved words. These words are used in Windows as a method of identifying a device file or another service.

This error could appear if your working team is using several Operating Systems (OS), or even if you are using Windows now and you were using another OS when you created/modified the project.
For instance, if your colleague is using Linux and creates a project in which there is a folder called “aux”. So when you try to clone/extract the project and you are using Windows, you get the above-mentioned error.

I highly recommend not to use these words in folder/file names, in order to ease the repository management for your actual or future colleagues. Thus here you have a list of windows reserved words, just in case you want to memorize them, in order to avoid them.

Windows and MS-DOS reserved words

  • AUX: Auxiliary port, the Serial Port COM1.
  • CON: Console.
  • From COM1 to COM9: COM ports.
  • From LPT1 to LPT9: LPT ports.
  • NUL: Null.
  • PRN: Printer.

How to bypass this error

I have three ideas:

  • Using other OS with WMware or VirtualBox for that project.
  • VS Code extension + Docker.
  • Buying your colleague to change the file/folder name to a more appropriate one. Some beers could be enough.

Personally, when I found this error I did the second one. These would be the steps I did:

  1. Create a Docker Container. This should use another OS (Linux for example) and contain all the tools you need for.
  2. Start the container and clone the repository there.
  3. Open Visual Studio Code on your local machine and install this extension in case you do not have installed yet: Remote – Containers
  4. Press F1 to bring up the Command Palette and type in Remote-Containers for a full list of commands. Click on Remote-Containers: Attach to Running Container.
  5. Choose the container you have in a running state with the repository cloned within.
  6. File -> Open folder -> choose your project -> et voilà! you are in.