I am trying to setup gitolite using the "directly on the server method" in the docs
Went through the entire setup, uploading the ssh public key etc... so now I can ssh git@myserver without prompting me for any passwords, all good.
I reached this step that I need to perform on my workstation, in my case a Mac OS
on the client, run cd; git clone git@server:gitolite-admin
running that is throwing this error:
Initialized empty Git repository in /Users/myLocalUser/gitolite-admin/.git/
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly
which tells me that it cannot find git-upload-pack, so I thought I would just have to add its path to the "git" user ".profile"
I just double checked and the path is there! if I:
ssh git@myServer
then call:
which git-upload-pack
I get the path as expected:
/usr/local/bin/git-upload-pack
What am I missing here?!
I can't seem to clone gitolite-admin, because of it keeps complaining about not being able t find git-upload-pack!!
Finally I got this solved by adding the PATH to .bashrc instead of .profile
git user is set to use /usr/bin/bash shell
I haven't realized that when I ssh to my server with user git:
the PATH variable is being read from .profile in git's home directory.
was displaying all the right paths included in .profile
but..
from my wrokstation, when I tried
the output was completely different, and the paths were all missing.
After adding .bashrc file to git's home directory, and defined all PATHs I needed inside .bashrc, and added /usr/local/bin/ where git-upload-pack is sitting, it worked as expected.
Always make sure the paths have been set where they should have been by running this command:
When you log in to a machine with ssh it starts a "login shell" and some of your login scripts are executed. If you remote execute a command with ssh, some other login scripts are executed. You can read about this here.
Your problem is (as you figured out) that the path to git-upload-pack is not set for the "non-login" shell.
You can either change the login scripts as you suggested. A perhaps simpler alternative is to specify the path to
git-upload-pack
on the command line like this:If you have a remote repository for which you have to use the --upload-pack a lot, you can make life easier by configuring git after the clone to always use that path for that repository
Unless you named your remote repository, the
<name-of-repo>
is usuallyorigin