threads / patch / 22029

patchSmart-http documentation: add example of how to execute from userdir

Subject: [PATCH] Smart-http documentation: add example of how to execute from userdir

## tl;dr

14 messages between Dec 26, 2009 and Jan 5, 2010. Diffs are folded; open one to read it.

replies: 13people: 4as markdown or json

Tarmigan Casebolt· Dec 26, 2009, 17:07 UTC · lore

Smart-http may be an attactive and easy way for people to setup git hosting on shared servers whose primary web server configuration they do not control. To facilite this, provide an example of how it may be done.

cc: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
---
 Documentation/git-http-backend.txt |   40 ++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 2 deletions(-)
Show changes to Documentation/git-http-backend.txt +38 −2
diff --git a/Documentation/git-http-backend.txt b/Documentation/git-http-backend.txt
index 67aec06..0cca5ba 100644
--- a/Documentation/git-http-backend.txt
+++ b/Documentation/git-http-backend.txt
@@ -60,8 +60,8 @@ automatically by the web server.
 
 EXAMPLES
 --------
-All of the following examples map 'http://$hostname/git/foo/bar.git'
-to '/var/www/git/foo/bar.git'.
+Unless otherwise noted, the following examples map
+'http://$hostname/git/foo/bar.git' to '/var/www/git/foo/bar.git'.
 
 Apache 2.x::
 	Ensure mod_cgi, mod_alias, and mod_env are enabled, set
@@ -144,6 +144,42 @@ ScriptAliasMatch \
 ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
 ----------------------------------------------------------------
 
+In the following example, a repository at
+'/home/$username/devel/foo/bar.git' will be accessible at
+'http://$hostname/\~$username/cgi-bin/git/foo/bar.git'
+
+From UserDir on Apache 2.x::
+       One way to configure 'git-http-backend' to execute and serve
+       from a user directory (for example, on a shared hosting
+       provider), is to have a symbolic link that points from the cgi
+       directory to the 'git-http-backend' executable in libexec.  The
+       advantage of the symblic link is that any updates to the
+       installed version of 'git-http-backend' also update the version
+       that is run in the userdir.  Depending on the configuration of
+       the server, the symbolic link may be able to point to a global
+       installation of git.  If, for security reasons, the server is
+       configured to follow symbolic links only if the owner matches,
+       an installation of git into the user directory may be required.
+       In that case, install git as that user into \~/bin, \~/libexec
+       etc.  Then create a symlink named 'git' in the cgi-bin
+       directory that points to
+       \~/libexec/git-core/git-http-backend. Put the following in
+       \~/public_html/cgi-bin/.htaccess:
++
+----------------------------------------------------------------
+SetHandler cgi-script
+Options +SymLinksIfOwnerMatch
+SetEnv GIT_PROJECT_ROOT /home/$username/devel
+----------------------------------------------------------------
++
+Also add any needed authentication to the .htaccess file as discussed
+in earlier examples.
++
+If the web server does not follow any symbolic links, the
+'git-http-backend' executable may be copied into the cgi-bin directory
+and renamed to 'git' to acheive the same effect, but it will also need
+to be manually updated whenever a new version of 'git-http-backend' is
+installed.
 
 ENVIRONMENT
 -----------
-- 
1.6.6
Tay Ray Chuan· Dec 27, 2009, 03:19 UTC · re: Tarmigan Casebolt · lore

Re: [PATCH] Smart-http documentation: add example of how to execute from userdir

Hi,

On Sun, Dec 27, 2009 at 1:07 AM, Tarmigan Casebolt <tarmigan+git@gmail.com> wrote:

Show 8 quoted lines
> @@ -60,8 +60,8 @@ automatically by the web server.
>
>  EXAMPLES
>  --------
> -All of the following examples map 'http://$hostname/git/foo/bar.git'
> -to '/var/www/git/foo/bar.git'.
> +Unless otherwise noted, the following examples map
> +'http://$hostname/git/foo/bar.git' to '/var/www/git/foo/bar.git'.

This rephrase seems to be unrelated (to providing an example of serving smart http).

Show 14 quoted lines
> @@ -144,6 +144,42 @@ ScriptAliasMatch \
>  ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
>  ----------------------------------------------------------------
>
> +In the following example, a repository at
> +'/home/$username/devel/foo/bar.git' will be accessible at
> +'http://$hostname/\~$username/cgi-bin/git/foo/bar.git'
> +
> +From UserDir on Apache 2.x::
> +       One way to configure 'git-http-backend' to execute and serve
> +       from a user directory (for example, on a shared hosting
> +       provider), is to have a symbolic link that points from the cgi
> +       directory to the 'git-http-backend' executable in libexec.  The
> +       advantage of the symblic link is that any updates to the
s/symblic/symbolic/.
> +       installed version of 'git-http-backend' also update the version
s/update/updates/.
> +       that is run in the userdir.  Depending on the configuration of
> +       the server, the symbolic link may be able to point to a global
> +       installation of git.  If, for security reasons, the server is

At this point, the user dealing with the "easy" case (ie. the user just symlinks the shared git installation and doesn't have to create symlinks in his own home directory) should have enough configuration details without having to read any further. So, you could tell the user about the symlinks to create and the configuration lines in .htaccess.

It might also be a good idea to start a new paragraph for the "hard" case, for better readability.

-- 
Cheers,
Ray Chuan
Tarmigan· Dec 28, 2009, 04:18 UTC · re: Tay Ray Chuan · lore

Re: [PATCH] Smart-http documentation: add example of how to execute from userdir

On Sat, Dec 26, 2009 at 10:19 PM, Tay Ray Chuan <rctay89@gmail.com> wrote:
Show 7 quoted lines
>> -All of the following examples map 'http://$hostname/git/foo/bar.git'
>> -to '/var/www/git/foo/bar.git'.
>> +Unless otherwise noted, the following examples map
>> +'http://$hostname/git/foo/bar.git' to '/var/www/git/foo/bar.git'.
>
> This rephrase seems to be unrelated (to providing an example of
> serving smart http).

I think this change is related because previously all the examples provided the same mapping. With the new example with a different mapping, the "_All_ of the following" is no longer true.

Show 17 quoted lines
>> @@ -144,6 +144,42 @@ ScriptAliasMatch \
>>  ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
>>  ----------------------------------------------------------------
>>
>> +In the following example, a repository at
>> +'/home/$username/devel/foo/bar.git' will be accessible at
>> +'http://$hostname/\~$username/cgi-bin/git/foo/bar.git'
>> +
>> +From UserDir on Apache 2.x::
>> +       One way to configure 'git-http-backend' to execute and serve
>> +       from a user directory (for example, on a shared hosting
>> +       provider), is to have a symbolic link that points from the cgi
>> +       directory to the 'git-http-backend' executable in libexec.  The
>> +       advantage of the symblic link is that any updates to the
>
> s/symblic/symbolic
> s/update/updates/.
Thanks.
Show 9 quoted lines
> At this point, the user dealing with the "easy" case (ie. the user
> just symlinks the shared git installation and doesn't have to create
> symlinks in his own home directory) should have enough configuration
> details without having to read any further. So, you could tell the
> user about the symlinks to create and the configuration lines in
> .htaccess.
>
> It might also be a good idea to start a new paragraph for the "hard"
> case, for better readability.
OK, these suggestions sound good to me.  I'll send out an updated patch shortly.

Thanks, Tarmigan

Tarmigan Casebolt· Dec 28, 2009, 04:46 UTC · re: Tarmigan · lore

[PATCH v2] Smart-http documentation: add example of how to execute from userdir

Smart-http may be an attactive and easy way for people to setup git hosting on shared servers whose primary web server configuration they do not control. To facilite this, provide an example of how it may be done.

cc: Tay Ray Chuan <rctay89@gmail.com>
cc: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
---
Looking at the 
	s/update/updates/
suggestion again, I decided not to make that change because I think
the original is grammical even if a little bit awkward.  The first
'updates' is the noun, so the verb should be 'update' without an 's'.

I also tried rephrasing that sentence completely, but did not end up with something better. Suggestions welcome.

 Documentation/git-http-backend.txt |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)
Show changes to Documentation/git-http-backend.txt +29 −2
diff --git a/Documentation/git-http-backend.txt b/Documentation/git-http-backend.txt
index 67aec06..fdff2d3 100644
--- a/Documentation/git-http-backend.txt
+++ b/Documentation/git-http-backend.txt
@@ -60,8 +60,8 @@ automatically by the web server.
 
 EXAMPLES
 --------
-All of the following examples map 'http://$hostname/git/foo/bar.git'
-to '/var/www/git/foo/bar.git'.
+Unless otherwise noted, the following examples map
+'http://$hostname/git/foo/bar.git' to '/var/www/git/foo/bar.git'.
 
 Apache 2.x::
 	Ensure mod_cgi, mod_alias, and mod_env are enabled, set
@@ -144,6 +144,33 @@ ScriptAliasMatch \
 ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
 ----------------------------------------------------------------
 
+In the following example, a repository at
+'/home/$username/devel/foo/bar.git' will be accessible at
+'http://$hostname/\~$username/cgi-bin/git/foo/bar.git'
+
+From UserDir on Apache 2.x::
+       One way to configure 'git-http-backend' to execute and serve
+       from a user directory (for example, on a shared hosting
+       provider), is to have a symbolic link named 'git' that points
+       from the cgi directory to the 'git-http-backend' executable in
+       libexec.  The advantage of the symbolic link is that any updates
+       to the installed version of 'git-http-backend' also update the
+       version that is run in the userdir.
++
+----------------------------------------------------------------
+SetHandler cgi-script
+Options +SymLinksIfOwnerMatch
+SetEnv GIT_PROJECT_ROOT /home/$username/devel
+----------------------------------------------------------------
++
+Also add any needed authentication to the .htaccess file as discussed
+in earlier examples.
++
+If the web server does not follow any symbolic links, the
+'git-http-backend' executable may be copied into the cgi-bin directory
+and renamed to 'git' to acheive the same effect, but it will also need
+to be manually updated whenever a new version of 'git-http-backend' is
+installed.
 
 ENVIRONMENT
 -----------
-- 
1.6.6.1.g8eede.dirty
Tay Ray Chuan· Dec 31, 2009, 02:18 UTC · re: Tarmigan Casebolt · lore

Re: [PATCH v2] Smart-http documentation: add example of how to execute from userdir

Hi,

On Mon, Dec 28, 2009 at 12:46 PM, Tarmigan Casebolt <tarmigan+git@gmail.com> wrote:

Show 5 quoted lines
> Looking at the
>        s/update/updates/
> suggestion again, I decided not to make that change because I think
> the original is grammical even if a little bit awkward.  The first
> 'updates' is the noun, so the verb should be 'update' without an 's'.
Indeed.
> I also tried rephrasing that sentence completely, but did not end up
> with something better. ?Suggestions welcome.
My attempt is found below.
> +In the following example, a repository at
I was thinking s/a repository at/the repository/.
> +'/home/$username/devel/foo/bar.git' will be accessible at
> +'http://$hostname/\~$username/cgi-bin/git/foo/bar.git'
You left out a full-stop for this sentence.
Show 8 quoted lines
> +From UserDir on Apache 2.x::
> +       One way to configure 'git-http-backend' to execute and serve
> +       from a user directory (for example, on a shared hosting
> +       provider), is to have a symbolic link named 'git' that points
> +       from the cgi directory to the 'git-http-backend' executable in
> +       libexec.  The advantage of the symbolic link is that any updates
> +       to the installed version of 'git-http-backend' also update the
> +       version that is run in the userdir.
We could try
  The advantage is that this symbolic link always points to the latest
  installed version; one does not have to make any changes to the
  symbolic link when the installed 'git-http-backend' is updated.

I thought the corollary (after the ';') was a bit long-winded, but it explains the advantage more clearly.

-- 
Cheers,
Ray Chuan
Tarmigan Casebolt· Jan 2, 2010, 21:18 UTC · re: Tay Ray Chuan · lore

[PATCH v3] Smart-http documentation: add example of how to execute from userdir

Smart-http may be an attactive and easy way for people to setup git hosting on shared servers whose primary web server configuration they do not control. To facilite this, provide an example of how it may be done.

cc:  Tay Ray Chuan <rctay89@gmail.com>
cc: Shawn O. Pearce <spearce@spearce.org>
Editing-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
---
 Documentation/git-http-backend.txt |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)
Show changes to Documentation/git-http-backend.txt +30 −2
diff --git a/Documentation/git-http-backend.txt b/Documentation/git-http-backend.txt
index 67aec06..0485033 100644
--- a/Documentation/git-http-backend.txt
+++ b/Documentation/git-http-backend.txt
@@ -60,8 +60,8 @@ automatically by the web server.
 
 EXAMPLES
 --------
-All of the following examples map 'http://$hostname/git/foo/bar.git'
-to '/var/www/git/foo/bar.git'.
+Unless otherwise noted, the following examples map
+'http://$hostname/git/foo/bar.git' to '/var/www/git/foo/bar.git'.
 
 Apache 2.x::
 	Ensure mod_cgi, mod_alias, and mod_env are enabled, set
@@ -144,6 +144,34 @@ ScriptAliasMatch \
 ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
 ----------------------------------------------------------------
 
+In the following example, the repository at
+'/home/$username/devel/foo/bar.git' will be accessible at
+'http://$hostname/~$username/cgi-bin/git/foo/bar.git'.
+
+From UserDir on Apache 2.x::
+       One way to configure 'git-http-backend' to execute and serve
+       from a user directory (for example, on a shared hosting
+       provider), is to have a symbolic link named 'git' that points
+       from the cgi directory to the 'git-http-backend' executable in
+       libexec.  The advantage is that this symbolic link always
+       points to the latest installed version; one does not have to
+       make any changes to the symbolic link when the installed
+       'git-http-backend' is updated.
++
+----------------------------------------------------------------
+SetHandler cgi-script
+Options +SymLinksIfOwnerMatch
+SetEnv GIT_PROJECT_ROOT /home/$username/devel
+----------------------------------------------------------------
++
+Also add any needed authentication to the .htaccess file as discussed
+in earlier examples.
++
+If the web server does not follow any symbolic links, the
+'git-http-backend' executable may be copied into the cgi-bin directory
+and renamed to 'git' to acheive the same effect, but it will also need
+to be manually updated whenever a new version of 'git-http-backend' is
+installed.
 
 ENVIRONMENT
 -----------
-- 
1.6.6.236.gc56f3
Tay Ray Chuan· Jan 3, 2010, 02:11 UTC · re: Tarmigan Casebolt · lore

Re: [PATCH v3] Smart-http documentation: add example of how to execute from userdir

Hi,

On Sun, Jan 3, 2010 at 5:18 AM, Tarmigan Casebolt <tarmigan+git@gmail.com> wrote:

Show 9 quoted lines
> Smart-http may be an attactive and easy way for people to setup git
> hosting on shared servers whose primary web server configuration they
> do not control.  To facilite this, provide an example of how it may be
> done.
>
> cc:  Tay Ray Chuan <rctay89@gmail.com>
> cc: Shawn O. Pearce <spearce@spearce.org>
> Editing-by: Tay Ray Chuan <rctay89@gmail.com>
> Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
-- 
Cheers,
Ray Chuan
Junio C Hamano· Jan 3, 2010, 08:34 UTC · re: Tarmigan Casebolt · lore

Re: [PATCH v3] Smart-http documentation: add example of how to execute from userdir

Tarmigan Casebolt <tarmigan+git@gmail.com> writes:
Show 9 quoted lines
> Smart-http may be an attactive and easy way for people to setup git
> hosting on shared servers whose primary web server configuration they
> do not control.  To facilite this, provide an example of how it may be
> done.
>
> cc:  Tay Ray Chuan <rctay89@gmail.com>
> cc: Shawn O. Pearce <spearce@spearce.org>
> Editing-by: Tay Ray Chuan <rctay89@gmail.com>
> Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>

I still see Cc: here; are people named above (and others commented on earlier versions) happy with this round?

Shawn O. Pearce· Jan 4, 2010, 14:06 UTC · re: Junio C Hamano · lore

Re: [PATCH v3] Smart-http documentation: add example of how to execute from userdir

Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Tarmigan Casebolt <tarmigan+git@gmail.com> writes:
> 
> > Smart-http may be an attactive and easy way for people to setup git
> > hosting on shared servers whose primary web server configuration they
> > do not control.  To facilite this, provide an example of how it may be
> > done.
> >
> > cc:  Tay Ray Chuan <rctay89@gmail.com>
> > cc: Shawn O. Pearce <spearce@spearce.org>
> > Editing-by: Tay Ray Chuan <rctay89@gmail.com>
> > Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
> 
> I still see Cc: here; are people named above (and others commented on
> earlier versions) happy with this round?
I don't get why Options +SymLinksIfOwnerMatch is needed here.

If we are linking to the root installed git-http-backend Apache will actually reject the link, because the link owner is likely to be $USER while the target is owned by root.

So I really can't ACK this, the instructions don't jive with my understanding of the Apache configuration.

-- 
Shawn.
Tarmigan· Jan 5, 2010, 07:59 UTC · re: Shawn O. Pearce · lore

Re: [PATCH v3] Smart-http documentation: add example of how to execute from userdir

On Mon, Jan 4, 2010 at 6:06 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 12 quoted lines
> Junio C Hamano <gitster@pobox.com> wrote:
>> I still see Cc: here; are people named above (and others commented on
>> earlier versions) happy with this round?
>
> I don't get why Options +SymLinksIfOwnerMatch is needed here.
>
> If we are linking to the root installed git-http-backend Apache
> will actually reject the link, because the link owner is likely to
> be $USER while the target is owned by root.
>
> So I really can't ACK this, the instructions don't jive with my
> understanding of the Apache configuration.
Fair enough.
There seem to be three reasonable ways to run from a userdir
(depending on what the global configuration allows):
- symlink to global git installation (if FollowSymLinks)
- symlink to user's git installation (if not FollowSymLink and only
SymLinkIfOwnerMatch)
- copy of git-http-backend binary (if no symlinks are followed)

The Options +SymLinksIfOwnerMatch is left over from when there was a more detailed description of the second scenario and should probably be removed now. The user may not have a choice about which of those three can be used because it depends on the global server configuration (which presumably the user does not control) so it's difficult to provide instructions that will work for everyone. The last option is likely to be the most portable, but also does not get updated when the primary http-backend binary is updated.

Enumerating the details of setting up all of these configurations in the man page seems excessive, but it would also be nice to have enough information to still make it easy.

We could do one or more of the following:
- Remove the Options +SymLinksIfOwnerMatch as it is too specific to an
unknown configuration and let users figure out how to get symlinks to
work for their particular configuration
- Add a note to remind the user about SymLinksIfOwnerMatch or FollowSymLinks
- Emphasize copying git-http-backend binary into the cgi-bin directory
as that is likely the most portable across configurations
- Expand all three scenarios in detail

I'm inclined to do the first two with the following patch (cut-n-paste warning) squashed in. I'll send the complete patch as a follow up.

Thanks, Tarmigan

Show changes to Documentation/git-http-backend.txt +2 −1
diff --git a/Documentation/git-http-backend.txt b/Documentation/git-http-backend
index 0485033..7af1288 100644
--- a/Documentation/git-http-backend.txt
+++ b/Documentation/git-http-backend.txt
@@ -160,13 +160,14 @@ From UserDir on Apache 2.x::
 +
 ----------------------------------------------------------------
 SetHandler cgi-script
-Options +SymLinksIfOwnerMatch
 SetEnv GIT_PROJECT_ROOT /home/$username/devel
 ----------------------------------------------------------------
 +
 Also add any needed authentication to the .htaccess file as discussed
 in earlier examples.
 +
+Depending on the global configuration of the web server, the
+"FollowSymLinks" or "SymLinksIfOwnerMatch" options might be needed.
 If the web server does not follow any symbolic links, the
 'git-http-backend' executable may be copied into the cgi-bin directory
 and renamed to 'git' to acheive the same effect, but it will also need
Tarmigan Casebolt· Jan 5, 2010, 07:59 UTC · re: Tarmigan · lore

[PATCH v4] Smart-http documentation: add example of how to execute from userdir

Smart-http may be an attactive and easy way for people to setup git hosting on shared servers whose primary web server configuration they do not control. To facilite this, provide an example of how it may be done.

cc:  Tay Ray Chuan <rctay89@gmail.com>
cc: Shawn O. Pearce <spearce@spearce.org>
Edited-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
---
 Documentation/git-http-backend.txt |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)
Show changes to Documentation/git-http-backend.txt +31 −2
diff --git a/Documentation/git-http-backend.txt b/Documentation/git-http-backend.txt
index 67aec06..7af1288 100644
--- a/Documentation/git-http-backend.txt
+++ b/Documentation/git-http-backend.txt
@@ -60,8 +60,8 @@ automatically by the web server.
 
 EXAMPLES
 --------
-All of the following examples map 'http://$hostname/git/foo/bar.git'
-to '/var/www/git/foo/bar.git'.
+Unless otherwise noted, the following examples map
+'http://$hostname/git/foo/bar.git' to '/var/www/git/foo/bar.git'.
 
 Apache 2.x::
 	Ensure mod_cgi, mod_alias, and mod_env are enabled, set
@@ -144,6 +144,35 @@ ScriptAliasMatch \
 ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
 ----------------------------------------------------------------
 
+In the following example, the repository at
+'/home/$username/devel/foo/bar.git' will be accessible at
+'http://$hostname/~$username/cgi-bin/git/foo/bar.git'.
+
+From UserDir on Apache 2.x::
+       One way to configure 'git-http-backend' to execute and serve
+       from a user directory (for example, on a shared hosting
+       provider), is to have a symbolic link named 'git' that points
+       from the cgi directory to the 'git-http-backend' executable in
+       libexec.  The advantage is that this symbolic link always
+       points to the latest installed version; one does not have to
+       make any changes to the symbolic link when the installed
+       'git-http-backend' is updated.
++
+----------------------------------------------------------------
+SetHandler cgi-script
+SetEnv GIT_PROJECT_ROOT /home/$username/devel
+----------------------------------------------------------------
++
+Also add any needed authentication to the .htaccess file as discussed
+in earlier examples.
++
+Depending on the global configuration of the web server, the
+"FollowSymLinks" or "SymLinksIfOwnerMatch" options might be needed.
+If the web server does not follow any symbolic links, the
+'git-http-backend' executable may be copied into the cgi-bin directory
+and renamed to 'git' to acheive the same effect, but it will also need
+to be manually updated whenever a new version of 'git-http-backend' is
+installed.
 
 ENVIRONMENT
 -----------
-- 
1.6.6
Junio C Hamano· Jan 5, 2010, 08:23 UTC · re: Tarmigan Casebolt · lore

Re: [PATCH v4] Smart-http documentation: add example of how to execute from userdir

Tarmigan Casebolt <tarmigan+git@gmail.com> writes:
Show 7 quoted lines
> +Depending on the global configuration of the web server, the
> +"FollowSymLinks" or "SymLinksIfOwnerMatch" options might be needed.
> +If the web server does not follow any symbolic links, the
> +'git-http-backend' executable may be copied into the cgi-bin directory
> +and renamed to 'git' to acheive the same effect, but it will also need
> +to be manually updated whenever a new version of 'git-http-backend' is
> +installed.

Hmph, has Apache heard of hardlinks? If not, wouldn't this be much simpler?

    cat >git <<\EOF
    #!/bin/sh
    exec /path/to/libexec/git-core/git-http-backend "$@"
    EOF
    chmod +x git
Shawn O. Pearce· Dec 27, 2009, 21:15 UTC · re: Tarmigan Casebolt · lore

Re: [PATCH] Smart-http documentation: add example of how to execute from userdir

Tarmigan Casebolt <tarmigan+git@gmail.com> wrote:
> Smart-http may be an attactive and easy way for people to setup git
> hosting on shared servers whose primary web server configuration they
> do not control.  To facilite this, provide an example of how it may be
> done.
...
Show 7 quoted lines
> +       \~/public_html/cgi-bin/.htaccess:
> ++
> +----------------------------------------------------------------
> +SetHandler cgi-script
> +Options +SymLinksIfOwnerMatch
> +SetEnv GIT_PROJECT_ROOT /home/$username/devel
> +----------------------------------------------------------------
At this point, isn't this just easier?
  mkdir ~/public_html/git
  vi ~/public_html/git/.htaccess
  SetEnv GIT_PROJECT_ROOT /home/$username/devel
  ScriptAlias / /usr/libexec/git-core/git-http-backend/

No need to mess around with SymlinksIfOwnerMatch and all of that fun. If you have .htaccess override allows, you should be able to setup a ScriptAlias without needing to use a cgi-bin directory.

-- 
Shawn.
Tarmigan· Dec 28, 2009, 04:06 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] Smart-http documentation: add example of how to execute from userdir

On Sun, Dec 27, 2009 at 4:15 PM, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 21 quoted lines
> Tarmigan Casebolt <tarmigan+git@gmail.com> wrote:
>> Smart-http may be an attactive and easy way for people to setup git
>> hosting on shared servers whose primary web server configuration they
>> do not control.  To facilite this, provide an example of how it may be
>> done.
> ...
>> +       \~/public_html/cgi-bin/.htaccess:
>> ++
>> +----------------------------------------------------------------
>> +SetHandler cgi-script
>> +Options +SymLinksIfOwnerMatch
>> +SetEnv GIT_PROJECT_ROOT /home/$username/devel
>> +----------------------------------------------------------------
>
> At this point, isn't this just easier?
>
>  mkdir ~/public_html/git
>  vi ~/public_html/git/.htaccess
>
>  SetEnv GIT_PROJECT_ROOT /home/$username/devel
>  ScriptAlias / /usr/libexec/git-core/git-http-backend/

Yes, that would be perfect. But ScriptAlias is only valid in the "server config" or "virtual host" contexts which is why the symlink/copy executable convolutions might be needed. Can you see a simpler way around it?

Thanks, Tarmigan

← back to recent threads