Git pull error: unable to create file (Invalid

2019-01-23 11:42发布

问题:

I am trying to sync remote repo with local repo but getting following errors. Some files (which have not extention) are not getting sync with local repo on WINDOWS machine, but I could sync successfully on MAC machine.

Is there any configuration settings in WINDOWS to handle such case?

  1. Using TortoiseGit
  2. Windows 7 64 bit machine

ERROR DETAILS

git.exe clone     --progress -v  "https://github.com/xxxx/xxxxx.git" "C:\Data\GitHub\simility\vishesh-common"

Cloning into 'C:\Data\GitHub\simility\vishesh-common'...
POST git-upload-pack (200 bytes)
remote: Counting objects: 3912, done.
remote: Compressing objects: 100% (487/487), done.
Receiving objects: 100% (3912/3912), 2.70 MiB | 567.00 KiB/s, done.
Resolving deltas: 100% (1578/1578), done.
remote: Total 3912 (delta 409), reused 0 (delta 0)
Checking connectivity... error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030050305_fantasy-trilogy-spin?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030295038_laser-dogs?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030315317_arizona-native-bird-painting-series?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030315317_native-birds-ii?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_ikeyboard-0?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_ikeyboard?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_only-you-can-prevent-computercide?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_vector-cupholder-protect-your-laptop-and-your-lap?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_103055429_death-of-an-angel?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030650665_rachel-vanslyke-making-a-new-record-together-we-ca?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030835091_russian-trucks-of-world-war-two?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1031873800_prop-expansion-next-level?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1031873800_prop-project-expansion?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1099860912_yaw-clock?ref=users (Invalid argument)
error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1099992656_heavenly-sight-a-vision-out-of-blindness?ref=users (Invalid argument)
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status' and retry the checkout with 'git checkout -f HEAD'

git did not exit cleanly (exit code 128) (21746 ms @ 29-09-2014 13:32:13)

回答1:

If I read that log well, those files have names that end with "?ref=users"

Windows does not allow you to have a '?' in a filename, just like it does not allow to have a "\" or "*". Under Linux it is possible, if you escape those characters. On Windows, I think it's not possible at all. See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247

You will have a hard time with such names.. I actually can't come up with any idea that would allow you to sync that 1:1. You certainly can fetch them and save them under some safe names like _projects_1099992656_heavenly-sight-a-vision-out-of-blindness__ref=users but I don't know how to do that automatically, or how to later inform Git about that mapping, sorry..

These filenames look like they have a HTML-query-parameters suffixed to them. Is it really required? maybe that's just some artifact that could be removed? try talking to the mantainers of the project, maybe they will be able to simply remove that odd suffix?



回答2:

I ran into the same problem, but wasn't willing to rename or delete these files. So here's a workaround in case you can live without accessing those files using a sparse-checkout:

Go to the .git folder in your repo and open the file config. (You can also edit your configuration using tortoise-git, but I havn't got it installed here.) In the [core]section add the line

sparsecheckout = true

then go to the folder .git/info and create the file sparse-checkout. Add something like

*
!kickstarter/parsers/data/kickstarter/campaigndetails/*

The first line includes everything, while the second excludes all files in kickstarter/parsers/data/kickstarter/campaigndetails/. You should now be able to checkout the repo. Using wild-cards you can probably do more sophisticated excludes.



回答3:

I'm using bitbucket and it has function that you can delete a problem file.

This is what I do.

  1. Go to your repository.
  2. Choose menu "commit".
  3. Select your branch that you want to remove problem file.
  4. Go to your file and click it. You will reach the file overview that show the detail of the file e.g. your code, date time of this file committed, etc.
  5. Look at upper right corner, you will see the button with arrow down image (similar to alphabet v) click it.
  6. It will dropdown and show you rename button and delete button inside it.
  7. Then it's your choice, will rename it or delete it. Choose wisely.
  8. After you click a button. Bitbucket will show you a dialog box do as it said and commit your file with commit button.
  9. After commit you can return to sourcetree and pull your code with no problem.
  10. Enjoy!