Git Push error : Unable to create temporary object directory what's that for?
Push code from VsCode to the server :
fatal: sha1 file '<stdout>' write error: Broken pipe
error: remote unpack failed: unable to create temporary object directory to /var/www/staging.site.com/staging.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'sitehost:/var/www/site.com/staging.git'
i change it too, for ubuntu user:
sudo chown ubuntu /var/www/staging.site.com/staging.git
@roygoode this error usually occurs in git when you are trying to execute a git push using a user with ownership permissions which are different to the read write permissions on the remote / destination repo. One of the most common reasons this occurs is when you create the repository locally using sudo or root privileges.
A common solution to this would be to change git user and git group permissions on the repo like this whilst in root:
# chown -R git:git 'sitehost:/var/www/site.com/staging.git'
Then retry the git push.
Hope that helps.
@Yamis1745
ls -l '/var/www/mySite'
total 16
drwxr-xr-x 2 ubuntu ubuntu 4096 Sep 15 01:05 public
-rwxr-xr-x 1 ubuntu ubuntu 11925 Sep 15 13:08 worker.log
/// and git hook is ROOT!! that i set post-receive in hooks dir.
ls -l '/var/repo/site.git'
total 32
-rw-r--r-- 1 root root 23 Sep 11 16:40 HEAD
drwxr-xr-x 2 root root 4096 Sep 11 16:40 branches
-rw-r--r-- 1 root root 66 Sep 11 16:40 config
-rw-r--r-- 1 root root 73 Sep 11 16:40 description
drwxr-xr-x 2 root root 4096 Sep 14 00:15 hooks
drwxr-xr-x 2 root root 4096 Sep 11 16:40 info
drwxr-xr-x 4 root root 4096 Sep 11 16:40 objects
drwxr-xr-x 4 root root 4096 Sep 11 16:40 refs
in VsCode i use ubuntu for git remote :
git remote add production ubuntu@myhost:/var/repo/site.git
So what can i do?
@RoyGoode you need to change the permissions in this directory to use your ubuntu:ubuntu permissions:
Run this command on this directory recursively:
$ chown -R git:git yourDirectory
This should change this:
-rw-r--r-- 1 root root 23 Sep 11 16:40 HEAD
drwxr-xr-x 2 root root 4096 Sep 11 16:40 branches
-rw-r--r-- 1 root root 66 Sep 11 16:40 config
-rw-r--r-- 1 root root 73 Sep 11 16:40 description
drwxr-xr-x 2 root root 4096 Sep 14 00:15 hooks
drwxr-xr-x 2 root root 4096 Sep 11 16:40 info
drwxr-xr-x 4 root root 4096 Sep 11 16:40 objects
drwxr-xr-x 4 root root 4096 Sep 11 16:40 refs
To:
-rw-r--r-- 1 ubuntu ubuntu 23 Sep 11 16:40 HEAD
drwxr-xr-x 2 ubuntu ubuntu 4096 Sep 11 16:40 branches
-rw-r--r-- 1 ubuntu ubuntu 66 Sep 11 16:40 config
-rw-r--r-- 1 ubuntu ubuntu 73 Sep 11 16:40 description
drwxr-xr-x 2 ubuntu ubuntu 4096 Sep 14 00:15 hooks
drwxr-xr-x 2 ubuntu ubuntu 4096 Sep 11 16:40 info
drwxr-xr-x 4 ubuntu ubuntu 4096 Sep 11 16:40 objects
drwxr-xr-x 4 ubuntu ubuntu 4096 Sep 11 16:40 refs
Now retry your git push. If your SSH keys are correctly configured, then all should be good.
Hope that helps.
Please sign in or create an account to participate in this conversation.