34

I'm using remote git repository. I successfully commit my files and now I'm trying to push it up to stream.

Operation fails with this messasge:

git.exe push --progress  "origin" master:master

error: unpack failed: unpack-objects abnormal exit
error: RPC failed; result=18, HTTP code = 200

I use TortoiseGit client on Windows 7.

Why am I getting this message? how to recover from this state?

Ben James
  • 121,135
  • 26
  • 193
  • 155
vlcik
  • 911
  • 4
  • 20
  • 33

12 Answers12

37

If your git repo is self hosted, check the file system rights on the remote git directory. If this gets corrupted, it is possible that your git server just doesn't have rights.

For instance, I host my own gitosis system on Ubuntu server. When I create the git repo on the server, I run sudo git init --bare <repo name> I then have to run sudo chgrp -R gitosis <repo name> && sudo chown -R gitosis <repo name>.

sean_m
  • 1,564
  • 1
  • 12
  • 14
  • That was the good answer for me, I had few directory owned by root instead of the right git user. – ôkio Jul 31 '17 at 15:25
28

According to this article git repack remote/origin/master might help in case your local repository was corrupted. To check that you can try cloning your remote repo into new directory and test push from it.

KL-7
  • 46,000
  • 9
  • 87
  • 74
  • 1
    It doesn't work. It seems there is problem file, which doesn't allow git to pack and push. Is it possible? how to solve it? – vlcik Dec 09 '11 at 10:53
  • 6
    In fact, the command `git repack` solved my (similar) issue. So +1 – strpeter Dec 16 '13 at 23:56
8

This also occurs when the remote has no space left on it, try free up some space.

tread
  • 10,133
  • 17
  • 95
  • 170
1

Do check the permissions on the remote/origin repository. Are they writeable by the git user? If not, you will get this error. Something like:

chown git_user.git_user -R /path/to/repo/your_funky_repo

should do the trick on *nix systems. If your remote is on windows, I am sure there's something equivalent you could run.

Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
1

I encountered this problem when I set up a fresh remote server and created the remote git repo/folders with my root user (rather than my personal user acct). Problem fixed by deleting the git repos and redoing them with my personal account. all works as expected now.

wkd
  • 231
  • 1
  • 5
  • 16
0

Also check if your disk is not full. I ran into the same problem on one of my VPS few minutes ago.

Makoto
  • 104,088
  • 27
  • 192
  • 230
JakubKnejzlik
  • 6,363
  • 3
  • 40
  • 41
0

I've run into the same trouble when I changed my git from VPN to https connection.

Something happend in my git Repository and I couldn't push anymore, but pull still worked. I also tried the Solution with git -repack remote/origin/master, but still same Issue.

To solve this, I just made a new clone from my repo with the new connection and was able to use push methods as known. I don't know really why this couldn't be solved by git -repack, but in this way it works for sure!

I guess there was something that doesn't fit with the VPN remote settings for the Server as I changed the access method to https.

Hope this helps.

Gkiokan
  • 3,492
  • 2
  • 22
  • 24
  • Excuse me, why got this downvoted? Any other answers for this problem didn't helped for me. My solution is maybe not the best one, but it provides a working solution. So anyone who's running into this error and cannot figure it out, may try to get it working in this way. Thanks. – Gkiokan Dec 28 '16 at 17:55
0

On Windows, the only fix that worked for me was to remove the following lines from my .gitconfig file:

[credential]
helper = !'C:\\Users\\YourNameHere\\AppData\\Roaming\\GitCredStore\\git-credential-winstore.exe'

Once I did that, I manually pushed once (successfully), then added the above lines back to .gitconfig, and everything worked.

Noah Heldman
  • 6,724
  • 3
  • 40
  • 40
0

On my (gitlab) server, I needed first to chown -R git:git repositories/ , but git repack did not work. The issue was solved when I used scp to copy the object file from my local repo to the server:

    scp .git/objects/0d/449dd91d8c20c1820d1284371b28637e08a0f3 root@server:/home/git/repositories/my/project.git/objects/0d/
PHZ.fi-Pharazon
  • 1,479
  • 14
  • 15
0

If you use a HTTP URL, you cannot push data via HTTP. HTTP is for read only access. Use ssh instead.

Do git remote -v to check if your repository URL is a HTTP one. You can change this URL by doing this git remote set-url origin ssh:user@server/dir/project.git

After that, you can push!

zatenzu
  • 347
  • 2
  • 10
0

I successfully pushed it using "git push —no-thin origin HEAD"

Sometimes when we execute git push to push a new branch to a remote repository, it will be blocked by the remote repository.

Maybe we don't have the appropriate permissions. However, when I add the --no-thin parameter to git push, I can push it up.

However, this command may be affected by different levels of permissions, so there is no guarantee that it will be pushed. But I succeeded with this push.

Alien
  • 15,141
  • 6
  • 37
  • 57
hao wangg
  • 11
  • 1
0

In my case, the remote repo was a shallow clone. I was pushing a merge commit which apparently was using commits dated before the earliest commit the shallow repo had.

To fix this you need to unshallow the remote: git fetch --unshallow

Okneloper
  • 1,247
  • 1
  • 14
  • 25