Git clone displaying errors and marking files as d

2019-08-14 00:32发布

问题:

I am getting the following error when trying to clone a repository with git:

Fatal: Unable to checkout working tree
warning: Clone succeeded, but failed checkout.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Additionally, the following message appears in several files: 'error: Unable to create file'

http://i.imgur.com/vz13IMe.png

By using the 'git status' command, I see that many files were marked as deleted [actually the files still exist]

http://i.imgur.com/KoizHw0.png

I used the git checkout -f HEAD command as was requested in the first mistake, but the result was the following

http://i.imgur.com/miFEgMr.png

回答1:

Apparently, the files in your repository contain question marks (?) in their names. The question mark is a special symbol and is not permitted in a file name on Windows.

Afaik, there is no solution for your problem (apart from using a different OS).

However, why the filenames contain question marks? They look like they were scrapped from web by a web spider (on a different OS). The question mark and the fragment after it should not be part of the file names.



回答2:

Your files has special characters which are not allowed under windows. This is why you cannot checkout the file names.

The only way to fix it is to clone the repository on non windows machine and to rename them.

The following characters are forbidden in file names (Win)

The following reserved characters:

< (less than)  
> (greater than)  
: (colon)  
" (double quote)  
/ (forward slash)  
\ (backslash)  
| (vertical bar or pipe)  
? (question mark)  
&#42; (asterisk)