Is there any way to clone a git repository without a specific directory?
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.
3 Solutions collect form web for “Is there any way to clone a git repository without a specific directory?”
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 –
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.
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
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.
To avoid cloning one or several directories, you could use git sparse checkout as described here.