On Wed, 6 Apr 2016 07:43:19 -0700 (PDT)
Eli <elirenato2...@gmail.com> wrote:
> I'm trying to use Git over HTTP but I'm getting the error
> [Wed Apr 06 13:35:15.208592 2016] [cgi:error] [pid 6821] [client ...]
> AH01215: Not a git repository: '/var/git/repositories/my-project.git'
> On the client side I'm trying this:
> git clone http://myhost.com/git/my-project.git/
> Cloning into 'my-project'...
> fatal: repository 'http://myhost.com/git/my-project.git/' not found
> On the server side:
> The Apache Server is the version 2.4 and It has this configuration:
> SetEnv GIT_PROJECT_ROOT /var/git/repositories
> SetEnv GIT_HTTP_EXPORT_ALL
> ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
> <Directory "/usr/lib/git-core">
> Options +ExecCGI
> Require all granted
> The project root rirectory /var/git/repositories has the
> my-project.git directory that was initialized with the command git
> --bare init my-project.git. I also change the owner of the
> my-project.git directory to be the same as apache, so, chown -R
> apache:apache /var/git/repositories/my-project.git.
> Could you please help me figure out what I'm doing wrong? What I
> my git version is 1.9.1
Well, the error message you're observing in the Apache error log is
generated in the Git's http-backend.c when a call to function
enter_repo() which consumes a pathname and a flag and, if that flag is
unset, tries to locate the actual Git object database "ahcnored" at
In the http-backend.c this function is called with that flag unset
and it's called before a check is made for whether the repository is
So let's study the comment attached to enter_repo():
* First, one directory to try is determined by the following algorithm.
* (0) If "strict" is given, the path is used as given and no DWIM is
* done. Otherwise:
* (1) "~/path" to mean path under the running user's home directory;
* (2) "~user/path" to mean path under named user's home directory;
* (3) "relative/path" to mean cwd relative directory; or
* (4) "/absolute/path" to mean absolute directory.
* Unless "strict" is given, we check "%s/.git", "%s", "%s.git/.git", "%
* in this order. We select the first one that is a valid git
* chdir() to it. If none match, or we fail to chdir, we return NULL.
* If all goes well, we return the directory we used to chdir() (but
* before ~user is expanded), avoiding getcwd() resolving symbolic
* links. User relative paths are also returned as they are given,
* except DWIM suffixing.
const char *enter_repo(const char *path, int strict)
To me, that part about chdir() looks interesting. I'd say that for
some reason the git-http-backend process running with the credentials
of your web server fails to chdir() there.
So the first thing I'd try is to do
# su -l apache -s /bin/dash
$ cd /var/git/repositories/my-project.git
and see if that works OK.
The next thing to try would be more involved debugging.
I'd write a shell script reading
set -e -u
echo "$@" >"$FNAME"
exec /usr/bin/git-http-backend "$@"
, make it executable and stick it instead of the real Git HTTP backend
by adjusting the appropriate <Directory> entry of your Apache's
virtual host configuration.
Then I'd try accessing the repository and see whatever was output into
the temporary file -- to make sure the backend sees the correct
environment, has the expected credentials and receives sensible
...and while we're at it, what OS are you using?
Some sort of RH/Fedora/Centos?
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.