[cs631apue] Error in git push

Jan Schaumann jschauma at stevens.edu
Fri Nov 14 20:26:03 EST 2014


Sadia Akhter <sakhter at stevens.edu> wrote:
> I've google the error and they are saying its a permission problem.

Here's a funny thing: you often can tell what an error means without
using Google:

> sakhter at avalon:~/cs631/2014-Fall/final-project/slytherin$ git push 

> error: insufficient permission for adding an object to repository database ./objects

The part where it says "insufficient permission" hints at it being a
permission problem - no Google required! :-)

So yes, this is a permission problem, and it's not something you could
solve by yourself.

The git repository is a directory on a unix system, and so writing data
to the directory will apply all the regular unix access permission
semantics that you know.  In particular, in order for multiple users to
write to the same directory, it needs to be owned by a shared group, and
be group writable.

I had initialized the repositories for each group as such, and -- as you
can see when looking at the directories on linux-lab.stevens-tech.edu --
set the group setuid bit on the directory, meaning that newly created
files will also be owned by that group.  However, newly created
subdirectories will not automatically inherit the correct group
ownership or permissions.  To accomplish that, we'd need a filesystem
that supports Access Control Lists (ACLs).

The file server on which the data resides does not support ACLs, so
we'll need to fix this another way.  Basically, what we need is for any
commit that is made to change the group permissions and ownership to any
newly created files.  To accomplish that, I've added a 'post-receive'
hook to each git repository: a script, that is executed after the commit
is made.  This hook will run:

chown -R :${GROUP} ${PWD} >/dev/null 2>&1
chmod -R g+rwX ${PWD} >/dev/null 2>&1

This should be sufficient for any future commits.  However, there are
still some files left that already have the wrong permissions/ownership
and that need to be fixed.  If I had superuser privileges on the
filesystem, I could trivially fix this for you, but unfortunately, I do
not.

So each of you will have to do this once yourself:

- log in to linux-lab.cs.stevens.edu
- let GROUP be the name of your group
- let DIR be '~jschauma/apue/${GROUP}'
- run

chown -R :${GROUP} ${DIR} >/dev/null 2>&1
chmod -R g+rwX ${DIR} >/dev/null 2>&1

After each student has run these two commands once, everything should be
set and future commits should work out due to the post-receive hook.

If you run into problems, please let me know.

-Jan


More information about the cs631apue mailing list