Cannot push to remote git repo from one machine to another in LAN

7,194
error: remote unpack failed: unable to create temporary object directory

This means literally that when git goes to create a temporary directory to copy your changes into for further processing, the operating system is not allowing it to.

Specifically, as one of the first steps of the push process, git wants to create the directory .git/objects/incoming-XXXXXX where XXXXXX is a unique random identifier. This is what is failing.

The most common causes of this would be either that the security permissions of the repository directory do not allow the user you are SSH'ing as to write to it, or the disk is full.

To verify disk space, on the Linux host, run df -h and confirm that the filesystem the git repo is on does not show a high Use%, a low available number of blocks. Also try simply making a test file in the same location as the git repo.

To verify permissions, cd to the directory where the git repository is hosted on the remote, and run ls -l. Note the user and group that owns the file, and whether the user and/or group have write permissions here. To verify which groups your user is in, run groups $USER where $USER is the username.

If permissions are the problem, you may have to change the ownership of the git repository:

chown -R user:group srv/git/repo.git

Or you may need to adjust the group membership of your SSH user:

usermod -a -G gitgroup user
Share:
7,194
btlm
Author by

btlm

Updated on September 18, 2022

Comments

  • btlm
    btlm over 1 year

    I've created bare repo on my machine with Linux, also cloned it into local repo (on the same machine) and I can push/pull with no problems.

    On my workstation with Windows I've cloned that repo via ssh using git clone ssh://user@linuxhost/srv/git/repo.git and now cannot push anything. Git gives me following error:

    error: remote unpack failed: unable to create temporary object directory
    To ssh://linuxhost/srv/git/repo.git
     ! [remote rejected] master -> master (unpacker error)
    error: failed to push some refs to 
    'ssh://user@linuxhost/srv/git/repo.git'
    

    Found no correct answer to my problem, or answers were to complex to understand. I'm pretty new and unfamiliar with Linux and configurating my own gitserver.

    Thanks in advance

    • tgies
      tgies over 4 years
      Does the user you SSH in as have appropriate write permissions to the repository files?
    • btlm
      btlm over 4 years
      @tgies oh dude, I cannot believe that was as trivial as adding user to group... thank you! Now I have a problem with post-receive hook also with permissions I guess. If you could post your comment as an answer, I would mark it as solution.
    • tgies
      tgies over 4 years
      glad that helped. Posted as answer.
  • btlm
    btlm over 4 years
    Thank you once again, helped a lot!
  • m4l490n
    m4l490n about 4 years
    What do you mean by adjusting the group membership of my SSH user? is that adjustment on the server or locally? I have checked and all permissions and group ownerships are correct, also, the disk on the server is not full, it still has 70% available