git pull errors

萝らか妹 提交于 2020-01-02 18:45:12

问题


I'm trying to pull a commit made on a Linux machine into a Windows machine. I'm getting this error message:

error: git checkout-index: unable to create file my/folder/name/: (Invalid argument)

On the Linux machine there appeared to be 2 such 'name' folders called: 'name' and 'Name'. Even after uniting them under 'name' and re-committing, I still get the same error message.

On Windows I have git version 1.7.3.1.msysgit.0 and on Linux I have git version 1.7.5.4.

I did find a bunch of seemingly related SO questions of this nature, but none had a clear or relevant solution.

UPDATE: The files are hosted on a remote hosting service so that both Windows and Linux machines pull from the remote repo.


回答1:


Answering my own question due to the weirdness of the solution.

The first step is as @Don Branson, @VonC and @robinst suggested. I did a clean clone into a new folder on my Windows machine.
This did not seem to work, and git returned the exact same error.

However git status showed the offending folder as "deleted", even though a folder with the same name did exist and contained the proper files.
I then staged and committed the "deleted" folder, pushed to the remote repo. and pulled the commit from my original repo. Lo-and-behold the branch was updated properly.




回答2:


When you git pull git will apply the commits in order. So, even though the directories are consolidated by the final commit, they won't be in the commits it's applying to reach the HEAD. I'd try a new git clone on the Windows machine.




回答3:


The problem could be that Git first tries to create the new files (under the new name name) before the old directory Name has been deleted. So when it tries to create the new directory name it doesn't notice that Name already exists, because it compares them case-sensitive.

You could try the following (with a clean working directory of course):

  1. Recursively delete my/folder/Name (the old location).
  2. Do git reset --hard origin/branchname (the branch you are pulling).

Alternatively, just do a fresh clone.



来源:https://stackoverflow.com/questions/13065572/git-pull-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!