Getting the path right for git over SSH

Previous thread: [JGIT Patch] Added the package fnmatch and two exceptions. by Florian Koeberle on Wednesday, June 18, 2008 - 3:22 am. (1 message)

Next thread: [PATCH] Remove dependency on IO::String from Git.pm test by Michael Hendricks on Wednesday, June 18, 2008 - 6:37 am. (10 messages)
From: Ben Schmidt
Date: Wednesday, June 18, 2008 - 4:22 am

Hi,

I wrote the post below on the Apple Mac OS X Server mailing list, though
not subscribed to that list, because I found a solution that I thought
others might appreciate having documented, as I found it quite a bit of
trouble getting it right myself. Though written for Mac OS X, the
essentials apply to any Unix-like system. As the OP's problem arose when
using Git, I thought perhaps some other Git users may appreciate the
ideas as well, so I am forwarding this mail to you. If you think it
would be helpful, post it to a mailing list or FAQ somewhere, or
whatever else you like, and Google will hopefully find it and help other
users with it. The original message and my followup, which isn't
threaded, are here:

http://lists.apple.com/archives/macos-x-server/2008/May/msg00678.html
http://lists.apple.com/archives/macos-x-server/2008/Jun/msg00251.html


These kinds of issues have been annoying me, too, and Googling to find a
solution led me to your post. After more trouble than I would have
liked, I discovered and came up with the following. (Don't get
disheartened part way through; there is a pretty good climax at the
end!) (Also, though I am on Mac OS X Client/User 10.4.9, I expect all
this applies to Mac OS X Server, and probably to 10.5, too.)

- When ssh is started without a commandline, an interactive login shell
   is started. This is nice! Everything works!

- When ssh is started with a commandline, a non-interactive non-login
   shell is started. However...bash does not use $BASH_ENV in this case,
   so setting it in ~/.ssh/environment (e.g. to /etc/profile) doesn't
   help. What bash does is source /etc/bashrc and ~/.bashrc--it evidently
   treats ssh like rsh and does a little more than is documented even for
   rsh (search for rsh in the bash man page for details). This is pretty
   much never what I want, as I would like all ssh logins to be 'login
   shells' and use /etc/profile and ~/.profile, but only those that are
   interactive to use ~/.bashrc. I came up ...
Previous thread: [JGIT Patch] Added the package fnmatch and two exceptions. by Florian Koeberle on Wednesday, June 18, 2008 - 3:22 am. (1 message)

Next thread: [PATCH] Remove dependency on IO::String from Git.pm test by Michael Hendricks on Wednesday, June 18, 2008 - 6:37 am. (10 messages)