git clone with invalid name for windows

174 views
Skip to first unread message

Irakli Kobalava

unread,
Oct 24, 2016, 5:11:04 AM10/24/16
to git-for-windows
I am cloning a project that contains a folder named 'BLA:scss'. It won't clone because windows cant create a folder that contains the symbol - ':'
Any suggestions?

Johannes Sixt

unread,
Oct 24, 2016, 2:44:25 PM10/24/16
to Irakli Kobalava, git-for-windows
git clone .../BLA:CSS BLA_CSS

perhaps?

Konstantin Khomoutov

unread,
Oct 24, 2016, 3:40:22 PM10/24/16
to Irakli Kobalava, git-for-windows
Well, the first thing to note is that you won't be able to work with
such project on Windows "the normal way": it's simply impossible
because neither GfW nor "plain" Git do support any sort of "mapping"
for the names of the entities constituting a project. That is, GfW
won't be able to convert your "BLA:scss" into "BLA~1" on the filesystem
and convert it back whe you would be committing something located in
that directory. In other words, if you intend to actually _work_ on
that project -- as opposed to merely fetching it to get hold on the
data contained in it -- you have to sort this thing with the project's
owners to rename that directory into something more Windows-compatible.

If you merely need to get the project's data, then you should
understand that the only step that actually fails is an attempt to
check out the tip of the branch which is current in the repository
being cloned (typically "master"). That's because this is the only
step which actually tries to create the project's files on your local
filesystem: cloning itself (as in initializing the local repository and
piping the history from the remote to it) does not attempt to do that.

Hence to solve your problem merely pass the "--no-checkout"
command-line option to `git clone`: it will clone the repo but won't
attempt to actually check any project files into the work tree.

You can now get hold of your data. There are various ways to approach
it. The simplest is to use `git show` with explicit revision ("HEAD")
and pathnames -- like in

git show HEAD:path/to/a/file.txt >file.txt

to obtain the contents of the file "file.txt".

If you need to get most of the data checked out, I'd recommend to first
remove that offending directory from the index and then check out the
rest:

git read-tree HEAD
git rm -r --cached BLA:scss
git checkout-index -a
Reply all
Reply to author
Forward
0 new messages