Adi Shavit
Adi Shavit

Reputation: 17275

git pull errors

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.

Upvotes: 2

Views: 4848

Answers (3)

Adi Shavit
Adi Shavit

Reputation: 17275

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.

Upvotes: 2

robinst
robinst

Reputation: 31417

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.

Upvotes: 1

Don Branson
Don Branson

Reputation: 13709

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.

Upvotes: 1

Related Questions