On Wed, 14 Nov 2012 05:58:47 -0800 (PST)
kumar <t12...@gmail.com> wrote:

> I have setup smart http and now able to clone. I am using Ubuntu
> 12.10. but when i try to push i get the following error. 
> 
> $git push http://192.168.0.66/git/gitrepos/project1.git master
[...]
> ! [remote rejected] master -> master (n/a (unpacked error))
> error: failed to puh some refs to ' 
> http://192.168.0.66/git/gitrepos/project1.git'

What puzzles me about this error is that I fail to find the
"unpacked error" phrase in the Git source tree (a version near the 1.8.0
release):

% git grep 'unpacked error'
% git name-rev --tags master
master tags/v1.8.0-rc0~48

Same results with the checkout of 1.7.10.4 (which your version of
Ubuntu seems to have packaged).

It might be that this error message is synthetic, but I fail to find
any relevant context in the results of `git grep -w unpacked` as well.
Again, this might signalize nothing special as I just did a quick
glance, but are you sure you copied and pasted the error message
correctly?

> These are the setting have done.
> 
> SetEnv GIT_PROJECT_ROOT /var/www/git
> SetEnv GIT_HTTP_EXPORT_ALL
> ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
> SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
> 
> <Directory "/usr/lib/git/">
> AllowOverride None
> Options +ExecCGI -Includes
> Order allow,deny
> Allow from all
> </Directory>

This setting is odd, as the directory path for which you set
specific options using this directory does not match that specified by
the ScriptAlias directive above.

[...]
> I have set "git config http.receivepack true"
> I have given all permission to git folder drwxrwxrwx 3 root root 4096
> Nov 13 23:13 git
[...]

The ownership and permissions on the root directory for your Git project
are plain wrong -- never ever allow *everyone* read/write access to a
directory (unless it also has the sticky bit set on it (/tmp is one
example).

Please grant the ownership recursively to the user "www-data" and
the same-named group -- Apache on a typical Debian(-based) distro runs
with the credentials of this special system user [*].  Then also make
sure the permissions on the hierarchy is also OK.  I'm not sure this
will fix your problem but if we suppose the root cause of this failure
is the Git's inability to unpack what it received due to permission
problems, this might help.

One way to change ownership/permissions is to run:

$ sudo chown -R www-data:www-data /var/www/git

to fix ownership and then

$ sudo find /var/www/git -type d -exec chmod 0775 '{}' \; \
       -o -type f -exec chmod 0664 '{}' \;

to fix permissions (the trailing slash on the first line is to
signalize the line break to fit it into the mail message -- when running
the command on a real system remove it and write both parts on the same
line).

[*] It's possible to use something like mod-itk to allow serving
    different virtual hosts using different credentials but this is not
    the regular mode of operation, so do not consider this for now.

-- 


Reply via email to