19

I'm trying to create a new branch in my repo.

I did this:

git branch events
git Checkout events

That worked. So I changed some files and did:

git Status
git add --all
git commit -m "Commit"

That worked well but I tried to push it and that didn't work:

git push -u origin events

This is the error:

Enumerating objects: 9, done.                                                                                                                       
Counting objects: 100% (9/9), done.                                                                                                                 
Delta compression using up to 4 threads.                                                                                                            
Compressing objects: 100% (5/5), done.                                                                                                              
Writing objects: 100% (5/5), 716 bytes | 716.00 KiB/s, done.                                                                                        
Total 5 (delta 4), reused 0 (delta 0)                                                                                                               
error: remote unpack failed: unable to create temporary object directory                                                                            
To http://git.int.censoredlink/scm/freeb/freebrep.git                                                                                       
 ! [remote rejected] events -> events (unpacker error)                                                                                              
error: failed to push some refs to 'http://stsu@git.int.censoredlink/scm/freeb/freebrep.git'

I don't know why it does not work.

I have Admin rights on the Repo. I censored the link to the repo because its an internal Repo with private link.

vinzee
  • 10,965
  • 9
  • 34
  • 51
Störungs Sucher
  • 219
  • 1
  • 2
  • 8
  • If anyone comes a cross this my solution was simply deleting files on my dev server. Turns out my dev server storage was maxed out. – Mederic Apr 18 '19 at 07:28
  • Just for ref, I got this because I'd inadvertently cloned a repo using a user account that was valid on the server, but didn't have write access to the repo (D'Oh!). I fixed it by editing the 'remote-origin' entry in .git/config. – Martin CR Apr 05 '20 at 18:07
  • Check rights on `.git` dir on server side (or make `git init` on server side from pushed user) – Grigory Kislin May 04 '20 at 15:29
  • @MartinCR what did you edit in the `remote-origin` entry in .git/config? Was that in the remote server? or the local clone? – m4l490n May 07 '20 at 22:22
  • @m4l490n in the local clone: in the [remote "origin"] section I simply changed the username in the url=... line to one that had write access – Martin CR May 08 '20 at 06:03
  • @MartinCR looks like that will not work for me. There is no user in the URL I'm using. My URL is: `ssh://git.server.com:2222/path/to/repo/repo.git` – m4l490n May 08 '20 at 21:18
  • @m4l490n interesting... mine is `url = my.git.user@my.git.server:/path/to/repo.git` - so I guess that your server uses ssh with cert authentication. Do you have a valid cert in the correct location? – Martin CR May 09 '20 at 07:15
  • @MartinCR I must have had a typing error. The problem was that I indeed need to specify the user when I clone, not just `git.server.com`. It should be `user@git.server.com` – m4l490n May 09 '20 at 14:32

7 Answers7

23

This error message:

error: remote unpack failed: unable to create temporary object directory

indicates that the Git repository at the server (not your Git) is out of space, or running into similar server problems,1 or installed incorrectly. That is, given:

To: http://git.int.censoredlink/scm/freeb/freebrep.git

you will have to log in to the machine that serves HTTP traffic at git.int.censoredlink, walk down to the scm/freeb/freebrep.git directory, and correct the installation there. It's most likely a permissions issue: the receiving Git must be able to create, in the objects area, a directory named incoming-XXXXXX with the Xs replaced by a unique identifier, and then create within that directory a pack subdirectory.

All incoming objects and pack files are placed in these directories, in a sort of quarantine procedure, until the server-side Git hooks are satisfied with the reference name update requests. If the push fails, the quarantine directory is simply removed. If the push succeeds, the quarantined objects and/or pack files are migrated (and thin packs adjusted) into the normal object storage area. Note that the migration can fail even if the quarantine process succeeds; but if it does so, you get a different error reported to the client. (This error must also be corrected on the server.)

Note: it's rather unusual to push to http:// rather than https:// or ssh:// URLs. Inspect your server configuration to see who will own the various files thus created, and what permissions the web server will have.


1If a hard drive fails, Linux will sometimes mark the drive and/or its file systems read only. Or, even if you have disk space, you can run out of inodes. A number of different root causes will all lead to the same observed behavior on your client end. If you are a Linux admin checking on a server, look for system log messages, and consider both df and df -i output.

torek
  • 330,127
  • 43
  • 437
  • 552
  • 1
    Not entirely correct, but I’ve upvoted this nevertheless as it contained the clues needed to quickly debug this: `mkdir objects/incoming-XXXXXX` showed “no space left on device” in the case where the server admin needs to fix it which I just ran into. If you could reword or restructure the answer for that, it would be great. (I agree with _all_ your points, including the last paragraph, just that’s not the only cause for this effect.) – mirabilos Aug 29 '19 at 14:20
  • 1
    @mirabilos That is *another* possible cause. Wrong permissions is the more typical problem. – torek Aug 29 '19 at 15:14
  • 2
    Sure… if it never worked before, but not if this suddenly starts happening ☻ – mirabilos Aug 29 '19 at 15:46
  • @mirabilos: depends on whether you push with `ssh://@` and have set up group permissions. That's where I've seen this happen a lot. – torek Aug 29 '19 at 16:07
2

If you are working as a root user, please first change the user to your git user and then init your git directory:

  1. if you are root -> $ [root@server ~]#
  2. change user -> $ su - username
  3. init a git repo -> [username@server ~] $ git init --bare git-repo.git
  4. push from client -> Now you can push from the client:
    git remote add yourAliasName ssh://username@IP-or-HOST:sshPort/home/username/git-repo.git

Note:
I supposed you have created a public/private key already in your client and passed the public key to the /home/username/.ssh/authorized_keys server file. Otherwise you have to do it before step(4).

Ghasem Sadeghi
  • 1,144
  • 8
  • 21
1

I was getting the same error until I removed a .git subdirectory in the remote git repository.

The .git subdir was not writable by the git login account. Initially I had a permissions problem when trying to commit, and I suspect the .git subdir was created then.

jal
  • 11
  • 3
1

I got redirected here because of this error message.

error: remote unpack failed: unable to create temporary object directory

FYI: This can also occur when you are mounting the git directory read only

eg x.x.x.x:/nas/git on /mnt/git type nfs (ro,.....

Ken Fallon
  • 33
  • 4
0

I faced the same error when i tried pushing to "censored git server". The problem was on the server side. You can wait for some time until the sever gets back online properly or just contact the admin to get it fixed :)

Raj Salla
  • 37
  • 5
0

Recently I did encounter this error. The problem was the user did not have sufficient permission for example git remote add production ssh://username@{your-ip}/var/test/test.git` ensure the username did not have permissions

kenn
  • 763
  • 8
  • 16
0

Say on your Mac you're connecting to your own ubuntu server on AWS.

It's likely you will be connecting as user "ubuntu".

If permissions are a non-issue (it's just you), simply log in to your ubuntu server, and just

] chown ubuntu:ubuntu

all of the git directory in question. That will work fine.

Fattie
  • 30,632
  • 54
  • 336
  • 607