I just want to clone illumos-gate repository on my Windows machine. But unfortunately, there is an directory named 'aux' which is not allowed to be created in Windows since Windows regards aux as some device name. So is there any way to clone the whole git repository without this specific directory? Thanks in advance.
-
1Cloning a repository is no problem if you clone it bare. But **having a working directory** is the problem, because that's when the name "aux" gets exposed. – Nayuki Sep 07 '11 at 02:59
-
@Nayuki: Actually Windows is mess when it comes to devices. The names are reserved when using some interfaces, but not when using other ones. Msys uses the ones where they are reserved, but cygwin uses the (newer) one, where it's not. – Jan Hudec Sep 07 '11 at 06:19
3 Answers
Update: since the MSys2, on which all 2.x versions of Git For Windows are built, is a fork of Cygwin, these special filenames should now work just fine. You'll only have the issue if you are using ancient version (note the date of the question—2011).
While it's not possible with native windows tools or with msys, it is possible to create such directory with cygwin. So you can use cygwin git instead of msys one as workaround.
The cygwin git has three main disadvantages compared to the msys one: It does not register itself with the system, so you don't get the context menu in explorer (can be set manually, it's just an entry in registry), it's gui and gitk only work when cygwin X server is running and it sets funny access lists to everything as cygwin tries to emulate unix permissions (that can be tunred off in /etc/fstab
and I always do that; don't forget to set core.filemode
to false
in git than so it does not try to track executable bit). So that's why I normally use msys git even when running from cygwin, but as that does not work for you, cygwin git should be good enough substitute.

- 73,652
- 13
- 125
- 172
-
In my cygwin bash shell, `~ $mkdir aux` leads to "cannot create directory `aux': Not a directory"...? – Jonas Heidelberg Sep 07 '11 at 06:22
-
Have you tried cloning such a repo on cygwin? Or even normally creating an `aux` folder? – manojlds Sep 07 '11 at 06:24
-
@Jonas, @manojlds: Yes, I tried `mkdir aux` and than `echo foo > aux/con` and `cat aux/con` and they all worked. Than I tried removing the file and directory in explorer, which showed them, but failed to delete them and then I removed them using cygwin again. I have mostly up-to-date cygwin and Windows7; it may not work with older version of one or the other. – Jan Hudec Sep 07 '11 at 12:24
-
@Jan, it seems [you need cygwin 1.7.0](http://www.cygwin.com/cygwin-ug-net/using-specialnames.html) for it to work; no mention which Windows version on that page. – Jonas Heidelberg Sep 07 '11 at 12:44
-
-
@Jonas: There are some significant changes in cygwin 1.7. The most important being that mounts are now defined in `/etc/fstab` instead of `mount` writing them in registry and that `CYGWIN=nontsec` was replaced by flags in that file. – Jan Hudec Sep 08 '11 at 07:21
-
+1, works with cygwin 1.7.9-1 :-) [I deleted some of my comments to clean up here.] – Jonas Heidelberg Sep 08 '11 at 12:39
I can only think of a way which is rather painful:
Do a git clone without doing a checkout - git clone path --no-checkout
Now do a git reset - git reset
Now checkout every other file and folder except the aux one - git checkout master -- files/folders
Don't stage the deleted: aux/...
changes
Clearly, very painful. Only proper way is to clone and work on Linux.

- 290,304
- 63
- 469
- 417
To avoid cloning one or several directories, you could use git sparse checkout as described here.

- 1
- 1

- 4,984
- 1
- 27
- 41
-
Thanks, git sparse checkout seems a good feature. But before using it, it still needs to clone the whole repository. That's the problem. – Michael Sep 07 '11 at 07:01
-
I can't try it now, but I assume starting with `git clone path --no-checkout` as suggested by @manojlds could do the trick. – Jonas Heidelberg Sep 07 '11 at 08:52
-
1@Michael: No, it's not. The names of files from the work tree never appear inside `.git` and `clone` first fetches all the data and than checks them out. So `clone` only fails after it has downloaded all the data and you can simply proceed to creating the sparse work tree. Even if you forget the `--no-checkout` option initially. – Jan Hudec Sep 07 '11 at 12:27