12

When I do a git commit I see the following

>$ git commit -a
warning: unable to unlink .git/objects/63/tmp_obj_kK6IC9: Invalid argument
warning: unable to unlink .git/objects/2c/tmp_obj_SFNGla: Invalid argument

I can still perform git commit. However, I want to know how to get rid of the warnings.

Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
  • try running the same command with the `--verbose` flag so we can get some more debug output. – ThorSummoner Apr 03 '14 at 04:29
  • there is no extra debug output except that it shows the code differences for the files I am about to commit – Kim Stacks Apr 03 '14 at 04:39
  • 2
    Hmm, do you have any programs that might be holding those files 'in use', like a graphical interface? (suggested based off this article: http://stackoverflow.com/questions/7199496/git-checkout-warning-unable-to-unlink-files-permission-denied) – ThorSummoner Apr 03 '14 at 05:00
  • Please state the type of the filesystem your git directory is located on (e.g. `df -T .git`). – Helmut Grohne Apr 03 '14 at 06:37
  • the files are saved in NTFS on a cruzer fit drive. I am using mac os x. The reason why my mac os x can use a NTFS is because I have Paragon. Is that the reason why? – Kim Stacks Apr 03 '14 at 13:03

4 Answers4

23

I had a similar problem on OS X whenever trying to run "git repack" or "git gc", and I finally solved it after coming across this page: http://hints.macworld.com/article.php?story=20010610132749532

The fix is to open a terminal, go to your git repo, cd into the .git folder, and then type chflags -R nouchg *. If that was the issue, then after that, your git commands will work as normal.

willkil
  • 1,619
  • 1
  • 21
  • 33
Learn OpenGL ES
  • 4,759
  • 1
  • 36
  • 38
5

only delete ./git/gc.log file .

Selvin11
  • 51
  • 1
  • 2
2

I'm experiencing the same Problem on Windows 10. Following a hint here I suspect a company-logon-script in combination with the home drive mapped to a network drive. Logging off and back on solves it for me.

Tim Bq
  • 41
  • 4
  • 1
    this should be a comment not an answer – Stuart Aug 17 '18 at 14:46
  • 3
    Why? It's a solution to the question above that might help other users. Additionally: as a new user, I can only comment on my own questions and answers. – Tim Bq Aug 19 '18 at 20:00
1

Make sure nothing is running and try to checkout a new branch, if can't try git checkout -f master, then the warning won't appear again.

Frawel
  • 3,574
  • 1
  • 17
  • 13