GIT: ! [remote rejected] master -> master (n/a (unpacker error))

I’m working on multiple machines under multiple accounts on the same project and using git to sync between the codebases. The program by its nature has to run under root account, so no wonder at some point permissions got screwed up and I’ve got stuck with this error:

! [remote rejected] master -> master (n/a (unpacker error))

The solution is quite simple though requires access to the master repo:

Apparently because of git configuration mishmash in my remote repos I’ve got some files checked in as root and naturally when I tried to update the same files under a different account (git) I wasn’t able to rewrite the files. Get to your git origin and check out the objects directory there. Mine looked like this:

drwxr-xr-x 2 git git 51 Feb 23 23:36 d2
drwxr-xr-x 2 git root 51 Mar 1 15:14 d3
drwxr-xr-x 2 root root 51 Mar 1 22:14 d4
drwxr-xr-x 2 git git 141 Mar 1 15:14 db

Well, all you need to do is

chown -R git /objects

Also do not forget to edit .git/config file in your remote repo and fix that username so the situation won’t repeat in the future.

Leave a Reply