I've read this answer about eight-five times, but there's something I'm not understanding correctly:
git-upload-pack: command not found, how to fix this correctly
When I try to clone a repository on my server, I get the following:
bash: git-upload-pack: command not found
But when I clone by giving clone the -u /usr/local/bin/git-upload-pack
option, all works well.
I guess this makes sense, since that's the position of the git-upload-pack on my server.
The top answer suggests my .bashrc file on server needs to be updated to reflect this, as the result of ssh you@remotemachine echo \$PATH
does not return /usr/local/bin
. (It returns /usr/bin:/bin:/usr/sbin:/sbin
).
But when I look at my .bashrc file, it contains:
export PATH=/usr/local/bin:$PATH
So now I'm confused.
What do I need to do to avoid using the -u /usr/local/bin/git-upload-pack
option every time? Why does ssh you@remotemachine echo \$PATH
not return /usr/local/bin
? Is this something to do with login and non-login shells?
Please help! Thanks in advance.
Yes, it is to do with login and non-login shells. The
.bashrc
file only gets loaded in non-login shells. You can use.bash_profile
for login shells. Just add the same modification to yourPATH
in the.bash_profile
file and you should be good.You may find this is an interesting article on the difference between .bashrc and .bash_profile, and login and non-login shells.
I was getting the following errors:
git-credential-osxkeychain died of signal 11
When I was doing git pull, I would getfatal: https://github.com/.../../info/refs?service=git-upload-pack not found: did you run git update-server-info on the server?
I am guessing it had to do with my previous invalid github credentials in the keychain.
Incase any of the above answers does not help.
I solved this issue in my case by logging into the remote machine, a Ubuntu box, and doing
sudo apt-get install git
. Not sure if this is overkill or not, but solved the problem for me instantly.My solution for this problem
Check path for the git-upload-pack on your remote machine:
If it gives a path - copy it (without
git-upload-pack
and trailing slash. Examples:/usr/bin
,/home/yourname/bin
,/whatever/gituploadpack/path
, etc.).Check your PATH on the remote machine during login shell:
There is no such a path (
/whatever/gituploadpack/path
), is not it? Good!Login to your remote machine:
Open .bashrc_profile:
Find these lines if any:
...and change them for:
Open .bashrc:
Add these 4 lines:
Exit the remote machine:
Check your PATH on the remote machine during login shell:
Do you see
/whatever/gituploadpack/path
? Congrats!Note now you've solved not only
git-upload-pack
problem but alsogit-receive-pack
and other executables on your/whatever/gituploadpack/path
!This is connected to this issue:
https://serverfault.com/questions/130834/svnssh-getting-bash-to-load-my-path-over-ssh
Ssh is not loading your environment by default when sending a command without going to interactive mode.
good solution is the one with .ssh/environment file:
in /etc/ssh/sshd_config add:
Then just create .ssh/ directory and dump envronment to .ssh/enviroment:
Restart SSH
Now when you do this from your local machine:
you s'd get
and git clone s'd work.