1

Environment Data:

  • Git Version: 1.8.4
  • Operating System: Windows 7 Professional

I am running into an issue where I am attempting to issue a Git Status using the options --work-tree and --git-dir inside cmd.exe

When I run the following:

git --work-tree=E:\Workspaces\company --git-dir=E:\Workspaces\company\.git status

I receive the following:

fatal: index file open failed: Invalid argument

If I swap the status for a fetch then everything works flawlessly. The status however refuses to run within cmd.exe

If I run the command, modified slightly work within msysGit pathing expectations, it executes properly.

git --work-tree=/e/Workspaces/company --git-dir=/e/Workspaces/company/.git status

2 Answers 2

4

Maybe your first one would work if you escape your backslashes:

git --work-tree=E:\\Workspaces\\company --git-dir=E:\\Workspaces\\company\\.git status

UPDATE

I got it, try this:

git --work-tree="E:\Workspaces\company" --git-dir="E:\Workspaces\company\.git" status

I tried this and it worked for me. My directory even had spaces in it :-)

REAL UPDATE

It seems this is a regression that was introduced in 1.8.4 and you may have to downgrade to 1.8.3 for now until it is fixed and 1.8.5 is released. Or use bash in the meantime.

Here is a reference: https://stackoverflow.com/a/19511402/329928

And here is the issue on GitHub:

Tvangeste found that the "relative_path" function could not work properly on Windows if "in" and "prefix" have DOS drive prefix (such as "C:/windows").

E.g., When execute: test-path-utils, relative_path "C:/a/b" "D:/x/y" should return "C:/a/b", but returns "../../C:/a/b", which is wrong.

So make relative_path honor DOS drive prefix.

Sign up to request clarification or add additional context in comments.

6 Comments

Chris, This does't resolve the problem. I have tried this once before thinking the same thing. However, the fact that it works with FETCH nullifies this logic.
But it works with forward slashes, you say? git --work-tree=/e/Workspaces/company --git-dir=/e/Workspaces/company/.git status
Inside msysGit it does which interprets the input from shell quite differently.
Hey @JesseRiddle, I was able to get it to work for me by using double quotes.
C:\Users\jzr>git --work-tree="E:\Workspaces\company" --git-dir="E:\Workspaces\company\.git" status fatal: index file open failed: Invalid argument
|
0

Just create a new folder and paste your files there Re add the remote origin and it should push well for you

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.