Insufficient Permission Pushing to Git Shared Repo over Smart HTTP
Try running:
git repo-config core.sharedRepository true
This had solved similar issue for me. From the docs:
core.sharedRepository
If true, the repository is made shareable between several users in a
group (making sure all the files and objects are group-writable).
Can you verify the steps as given here ( this is definitely a permissions / groups issue):
http://parizek.com/?p=177
Git Push Error: insufficient permission for adding an object to repository database
Repair Permissions
After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:
cd /path/to/repo/.git
sudo chgrp -R groupname .
sudo chmod -R g+rwX .
sudo find . -type d -exec chmod g+s '{}' +
Note if you want everyone to be able to modify the repository, you don't need the chgrp
and you will want to change the chmod to sudo chmod -R a+rwX .
If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.
Underlying Causes
The error could be caused by one of the following:
The repository isn't configured to be a shared repository (see
core.sharedRepository
ingit help config
). If the output of:git config core.sharedRepository
is not
group
ortrue
or1
or some mask, try running:git config core.sharedRepository group
and then re-run the recursive
chmod
andchgrp
(see "Repair Permissions" above).The operating system doesn't interpret a setgid bit on directories as "all new files and subdirectories should inherit the group owner".
When
core.sharedRepository
istrue
orgroup
, Git relies on a feature of GNU operating systems (e.g., every Linux distribution) to ensure that newly created subdirectories are owned by the correct group (the group that all of the repository's users are in). This feature is documented in the GNU coreutils documentation:... [If] a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. ... [This mechanism lets] users share files more easily, by lessening the need to use
chmod
orchown
to share new files.However, not all operating systems have this feature (NetBSD is one example). For those operating systems, you should make sure that all of your Git users have the same default group. Alternatively, you can make the repository world-writable by running
git config core.sharedRepository world
(but be careful—this is less secure).The file system doesn't support the setgid bit (e.g., FAT). ext2, ext3, ext4 all support the setgid bit. As far as I know, the file systems that don't support the setgid bit also don't support the concept of group ownership so all files and directories will be owned by the same group anyway (which group is a mount option). In this case, make sure all Git users are in the group that owns all the files in the file system.
Not all of the Git users are in the same group that owns the repository directories. Make sure the group owner on the directories is correct and that all users are in that group.
GIT error while pushing to remote repository. Permission issues
There are issues with using a bare path. You should use the file
protocol to avoid Git trying to make hard links if you are executing it on a Linux box that's accessing the windows box.
To stop Git from trying to help you with hardlinks, use
file:///Apps-raphael/em/MockEMA/mockema.git
or something similar.
redmine with smart http and redmine_git_hosting does not allow pushing to repository
OK, I've figured it out (no thanx to the obscure error messages). I must be the only one who is using https!
Basically my virtual host configuration is missing the 3 entries re SSL:
SSLEngine on
SSLCertificateFile
SSLCertificateKeyFile
Git Smart HTTP protocol fails to execute server side hooks on push
The problem was in my httpd.conf file. Additionally I had to do
SetEnv PATH "C:\\Program Files\\Git\\bin;C:\\Program Files\\Git\\usr\\bin;${PATH}"
PassEnv USERNAME
First, the SetEnv
was necessary b.c. the interpreter wasn't being invoked. In one of my hooks, I have a shebang line of #!/usr/bin/env bash
, thus the addition of C:\Program Files\Git\usr\bin
. In another hook, I could have #!/bin/bash
, so C:\Program Files\Git\bin
would be necessary.
Secondly, the reason for PassEnv USERNAME
was because one of the hooks was utilizing that environment variable which httpd excludes out when passing an environment to the CGI script. It's talked about in the Apache docs here
Related Topics
Add Timestamp to Cat Output from Shell Script
How to Highlight The Differences Between Subsequent Lines in a File
Re-Stream a Mpeg2 Ts Pal Stream with Crtmpserver
Partitioning Images Based on Their White Space
-Bash: /Usr/Bin/Virtualenvwrapper.Sh: No Such File or Directory
Linux Directory Starting with Dot
Socket() Returns 0 in C Client Server Application
Fedora 28/Glibc 2.27 Libm.So.6 Logf() and Powf() C++
Elf File Tls and Load Program Sections
Automated Installation of R-Studio Using Shell Script
Apache/Httpd /Var/Www/HTML/ .Cgi Scripts Throw 500 Internal Server Error
Docker Rootless Unable to Pull Images
Do Here-Strings Undergo Word-Splitting