Git, error: remote unpack failed: unable to create temporary object directory - By creating new Branch
Asked Answered
G

10

44

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://[email protected]/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.

Gonfalon answered 24/7, 2018 at 9:25 Comment(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.Yapok
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.Esoterica
Check rights on .git dir on server side (or make git init on server side from pushed user)Backpack
@MartinCR what did you edit in the remote-origin entry in .git/config? Was that in the remote server? or the local clone?Incommodious
@Incommodious in the local clone: in the [remote "origin"] section I simply changed the username in the url=... line to one that had write accessEsoterica
@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.gitIncommodious
@Incommodious interesting... mine is url = [email protected]:/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?Esoterica
@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 [email protected]Incommodious
M
36

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.

Magically answered 24/7, 2018 at 16:42 Comment(4)
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.)Genteelism
@Genteelism That is another possible cause. Wrong permissions is the more typical problem.Magically
Sure… if it never worked before, but not if this suddenly starts happening ☻Genteelism
@mirabilos: depends on whether you push with ssh://<user>@<server> and have set up group permissions. That's where I've seen this happen a lot.Magically
R
27

90% chance it's a permissions issue.

  1. Login to the remote server.
  2. Navigate to /scm/freeb where freebrep.git is.
  3. call chown -R yourusername freebrep.git (where your user name is stsu)
  4. Try again. Now it should allow writing objects.
Rigby answered 1/9, 2021 at 15:12 Comment(3)
Also it could be that your disk is just out of space like in my case, look for available space on first place.... XDPozzuoli
Make sure you use sudo if you experience any issues with the command on number 3.Inartistic
For me I made the mistake of doing a "git clone user@ip/path.git" where "user@" was wrong so when I did "git push" it didn't have permissions.Paucity
K
6

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).

Knotting answered 19/7, 2020 at 13:18 Comment(1)
Future readers: If the git service is being run by a different user (that the user creating the push), the repo was likely created by the git service user. Therefore the username inusername@IP-or-HOST is required. This prevents the need to run chown on each newly created repo.Purusha
I
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.

Ilanailangilang answered 26/12, 2018 at 1:58 Comment(0)
B
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,.....

Burgos answered 20/2, 2019 at 10:4 Comment(0)
S
1

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

Subclinical answered 26/2, 2021 at 11:59 Comment(0)
J
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 :)

Joses answered 26/10, 2018 at 5:50 Comment(2)
Sorry mate, but this answer provides no helpful insights.Broom
sorry I could not provide a proper explanation. I have faced this error several times while working in a company and this error was generally faced when the server was down. Later , when server was back to normal, I could execute the push command. Anyway, thanks for feedback :)Joses
S
0

For me it was a dangling, crashed gitk-session: exclusively blocking file-access on a windoze-machine.

Supranational answered 13/7, 2021 at 10:15 Comment(0)
C
-1

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.

Cryo answered 27/4, 2021 at 16:34 Comment(0)
A
-1

Problem :- error: remote unpack failed: unable to create temporary object directory To https://url.com/scm/som/project.git ! [remote rejected] release/project-PROD-year_month_WeekNumber -> release/project-PROD-year_month_WeekNumber (unpacker error) error: failed to push some refs to 'https://url.com/scm/som/project.git'

Solution:- open gitbash goto project root directory .

chmod 777 *

then again try to git push

it work for me

Allround answered 30/11, 2022 at 16:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.