Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT pull failed: 'unable to unlink file: invalid argument'

New GIT user here, managing a Moodle course web site system on a Windows server. Trying to do my first Pull update of the core code (using TortoiseGit) and it's not working. Git is unable to unlink old versions of any the 200+ files to be updated because of an "invalid argument". I have no idea what that means.

Here's what it looks like after I dismiss 210 error dialogs: tortoisegit

I've rebooted the server and scoured the web for ideas, but I'm at a loss for what to try next.

Any ideas would be greatly appreciated!

like image 654
pillsbur Avatar asked Jul 26 '17 19:07

pillsbur


4 Answers

I lost hours with that error too.

In my case, I got this error because some files was locked by another program. I had to close everything then I was able to pull again.

Hope this help someone :)

like image 79
Nicolas Leucci Avatar answered Oct 15 '22 19:10

Nicolas Leucci


The error message shows the file name(s) that git was unable to unlink. In windows, you can go to Start Menu > Resource Monitor > CPU tab > Associated Handles and search for the file name (not the full path), then you will get a result of the process locking that file. In my case, it was explorer.exe. So I killed that process and git worked again as expected.

I guess you can do that same using other operating systems by finding the process(es) locking the file(s).

like image 33
Zein Makki Avatar answered Oct 15 '22 18:10

Zein Makki


Try to close any other tools while using Tortoisegit

like image 11
Ahmed AMMOURI Avatar answered Oct 15 '22 17:10

Ahmed AMMOURI


I also had unlink issues when trying to pull from gitlab.

Based on ivan866's and Nicolas Leucci's answer, to resolve I simply opened my SourceTree in administrative mode which fixed my problem. I suppose SourceTree didn't have enough rights to handle the permissions correctly. Anyway it's worth a try!

like image 9
Michael Manley Avatar answered Oct 15 '22 19:10

Michael Manley