Search code examples
gitpushinvalid-argumentgit-bare

Git push to remote fails: Unable to create../refs/heads/master.lock: Invalid argument


I have my git bare repo initialized in remote server folder /home/bare/mygit.git

I've cloned this repo:

git clone [email protected]:/home/bare/mygit.git .

Then I was working with project, doing commits/pushs, etc...

But today I noticed when I was doing a push this error:

user@host:/var/www/mygit (master)$ git push origin master
[email protected]'s password: 
Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 297 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
fatal: Unable to create '/home/bare/mygit.git/refs/heads/master.lock': Invalid argument
fatal: The remote end hung up unexpectedly
fatal: recursion detected in die handler

I searched this issue, but seems like mostly people have problem with a permissions. But in that case error looks different (like Permission denied or something).

Rights is ok, clonning/pulling/fetching is okay. No errors in log or something like that.


Solution

  • It was not a git related issue. Eventually I was not able to create some of new files.

    When I ran dmesg I saw a lot of errors from kernel. I decided to reboot server first and then dig deeper, but after server has been restarted issue has gone.

    Thanks everyone for helping!