git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unable to clone an ssh repository (with ugly installation-specific workaround)

From
SSStephen Sinclair <radarsat1@gmail.com>
Date
Feb 13, 2008, 14:17 UTC
Message-ID
<9b3e2dc20802130617m1c260c5fhb923e7a47e770f98@mail.gmail.com>
In-Reply-To
<51419b2c0802130457g25892543n9db02e681d9605c5@mail.gmail.com>
On Feb 13, 2008 7:57 AM, Elijah Newren <newren@gmail.com> wrote:
Show 31 quoted lines
> On Feb 12, 2008 3:30 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > > A quick work-around for Elijah is to add
> > >
> > >    GIT_EXEC_PATH=/home/enewren/software/install/linux/git/bin
> > >
> > > to .profile on the remote host.
> >
> > I guess you meant .bashrc, as .profile is not sourced when using ssh
> > transport (it does not spawn a shell) AFAIR.
>
> As far as I can tell, setting paths in .bashrc doesn't really work (or
> else I'm just doing it wrong).  If it did, I would have never hit this
> bug.  Observe the difference between (feel free to replace PATH with
> GIT_EXEC_PATH; same general result occurs):
>
>   $ ssh localhost
>   # Wait for connection to be made, then run
>   $ echo $PATH
>
> AND
>
>   $ ssh localhost 'echo $PATH'
>
> AND
>
>   $ ssh localhost 'source .bashrc
>   echo $PATH'
>
> The first and the third give the same result, but the second gives
> something different.  It is the second form that git uses, meaning
> that my paths never get set up.

I had this problem as well, and the only solution I found was setting up my .ssh/environment file. I guess when you specify a command for ssh, it executes this command by itself, not within a shell environment. Usually it is bash that sources .bashrc and .profile, so you don't get your paths set up. Unfortunately .ssh/environment is not a scripting environment, so you have to just specify your full path there, based on what you get when you echo $PATH from the shell. Also, this requires putting the following in sshd_config:

PermitUserEnvironment yes

Which, and this is the biter, is not usually a default on most systems, as far as I can see.. so it could mean bugging the sysadmin if it's not your machine, which is not always convenient. Can't see any alternative though.

Steve
Previous: Elijah Newren
Message 11 of 11 in “Unable to clone an ssh repository (with ugly installation-specific workaround)”
  1. Elijah NewrenFeb 12, 2008
  2. David SymondsFeb 12, 2008
  3. Jakub NarebskiFeb 12, 2008
  4. Johannes SixtFeb 12, 2008
  5. Johannes SchindelinFeb 12, 2008
  6. upload-pack: Initialize the exec-path.Johannes Sixt, Feb 12, 2008
  7. Johannes SchindelinFeb 12, 2008
  8. Johannes SchindelinFeb 12, 2008
  9. Elijah NewrenFeb 13, 2008
  10. Elijah NewrenFeb 13, 2008
  11. Stephen SinclairFeb 13, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.