blog

remedy git-upload-pack or git-receive-pack command not found errors when you have limited access to your server

April 27 2010 by Joseph Smith

Is your shell unable to locate your git-upload-pack or git-receive-pack when working with a remote repo on shared hosting?

When a client's host (Hostmonster) recently upgraded from openSSH4 to openSSH5, it locked us out of pushing/pulling via GIT with "git-upload-pack: command not found fatal" errors due to the fact that .bashrc files are ignored when running a single command in openSSH5 (no custom $PATH). Because this is a shared hosting environment, we didn't have access to /usr/bin/ (and rightfully so!) which means we can't use clever aliasing to solve this problem.

The _easiest_ solution? add the path to your git-upload-path and git-recieve-path in your local .git/config file under [remote "origin"].

i.e. change this

[remote "origin"]
	url = <the repo address>
	fetch = +refs/heads/*:refs/remotes/origin/*

to this
[remote "origin"]
	url = <the repo address>
	fetch = +refs/heads/*:refs/remotes/origin/*
	uploadpack = <path to git-upload-pack>
        receivepack = <path to git-receive-pack>

done and done.

When doing the initial clone

When doing the initial clone from the remote repository which is on Bluehost, this worked for me:
shell> git clone -u /path/of/remote/git-upload-pack <remote-repo> <local-dir>
You'll still need to setup the config file as described in this article, though, to get commands like 'git pull' to work from inside the newly created git directory.

This worked great for me on

This worked great for me on Bluehost. Thank you Joseph!

Hi buddy, I am bluehost

Hi buddy, I am bluehost client, and I made this configuration and doesn't worked. Do you have any idea? thks

I'm not on bluehost so i

I'm not on bluehost so i can't test the solution directly, but according to this, it sounds like you're upload pack on a Linux hosting package would be '/home//bin/git-upload-pack' (which could also be found by typing which git-upload-pack in your shell once you've ssh's into your hosting server)...

Alternatively, for a Windows hosting package 'libexec/git-core/git-upload-pack' seems to that platforms default location.

if one of those answers work, it's easy enough to sub in the 'git-receive-pack' info to get you up and running.

Joseph Smith

Joseph Smith

Joseph currently works full-time as a developer for Legwork Studio in Downtown Denver, CO.

In his past life, he was a touring musician and turned screws on/repaired Apple hardware.

Tags