0

I'm using Git (from the GitHub for Windows distro) and trying to pull from my repo and I get the following error:

D:\Code\dopey-weaver [master]> git fetch
error: cannot open .git/FETCH_HEAD: Invalid argument

D:\Code\dopey-weaver [master]> git fetch --verbose
error: cannot open .git/FETCH_HEAD: Invalid argument

This isn't the "Permission denied" of many other questions, so it seems like I'm a special snowflake... I can open .git/FETCH_HEAD and it looks fine(?):

010779f14f5bdf1d2d806a0ce0ac4c5e50314186        branch 'master' of https://github.com/nicktimko/dopey-weaver

I think I have some conflict with what's on the remote so I should be pulling/merging, but I can't even fetch to start... The error message on push does look a little long (is this the equivalent of hg saying "this would create multiple heads" in not so many words?)

D:\Code\dopey-weaver [master]> git push
To https://github.com/nicktimko/dopey-weaver.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/nicktimko/dopey-weaver.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
6
  • Could try strace git fetch Commented Jun 3, 2015 at 2:17
  • --verbose is not an option in the Ubuntu version of git. Are you sure it is supported under Windows? Commented Jun 3, 2015 at 2:19
  • @StevenPenny it gives the exact same error, I was just trying to have it maybe spit out something more. --verbose shows up as an option in the manpage Commented Jun 3, 2015 at 2:23
  • @NickT the point wasnt to get rid of the error, the point was so that you could diagnose the error. You should look up strace if you dont know what it does Commented Jun 3, 2015 at 2:27
  • @StevenPenny oh, I meant with and without -v. Is there a plain strace for Windows? I could try Process Monitor... Commented Jun 3, 2015 at 2:30

1 Answer 1

3

The problem appeared to be because the volume (an exFAT drive) was dirty, thus read-only, and needed to be run through chkdsk. So, to solve:

  1. Launch PowerShell/CMD in elevated mode (easy way being to right-click on the short-cut in the Start menu and pick "Run as administrator")
  2. Run chkdsk on the desired volume, e.g. chkdsk D: /X (/X forces a dismount)
    • If you're having this problem on the primary partition (C:), you'll probably have to do chkdsk at startup...somehow.
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.