On Tue, Nov 06, 2012 at 06:04:34PM -0800, brian_P wrote:

> I am new to git, and can't get past the error "fatal: Could not read from 
> remote repository"...
> Server: Mac OS X 10.6.8
> Remote Access (SSH) is enabled.
> My public key has been added to authorized_keys for the git user.
> I can ssh into the server as user "git". No password prompt.
> Repo on server is ~/git/ImgRip.git
> Used "git init --bare" to setup repo.
> Client: Mac OS X 10.6.8
> Local (new) git repo working fine (did a few test add and commits).
> Issued "git remote add origin g...@myserver.org:git/ImgRip.git" without 
> error.
> But when I "git push origin master" I get:
> bash: git-receive-pack: command not found
> fatal: Could not read from remote repository.

This happens because when you log in using SSH (no matter if you do this
by hand running `ssh` or Git runs it to connect to the server) the
server first spawns the shell configured to be the login shell of your
user, and the problem here is that Unix shells typically initialize
themselves differently depending on how they're called -- whether to
work as an interactive login shell or as a non-interactive shell.
In your case, when you log in "normally" you get interactive login shell
on the server; when Git logs in, it gets non-interactive shell.

Supposedly you have installed Git in a non-standard location and its
.../bin directory does not occur automatically in a list of "system
paths" (I assume Mac OS X uses the "PATH" environment variable for this,
like any other Unix-y system).  So supposedly you've adjusted this
variable in one of your shell rc-scripts, but it's not being read when
the shell is initialized as non-interactive.

I googled for "mac+os+x+non-interactive+shell+git" and it turned up [1]
and [2] which tell Mac OS X uses bash, and this means you either need to
tweak your ~/.bashrc (you've supposedly changed ~/.bash_profile instead)
or, if you need a system-wide solution, SSH have to be reconfigured

1. http://lists.apple.com/archives/macos-x-server/2008/Jun/msg00251.html
2. https://discussions.apple.com/thread/3766395?start=0&tstart=0


Reply via email to