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