So I’m using GIT, trying to push code to my remote server.
- on a shared unix hosting, and I’m not allowed to have my own environment variables (blocked for SSH accounts) and no sudo access.
- managed to install git successfully in my /home/
- trying to push code to the server returns : bash: git-upload-pack: command not found
- $PATH variable is set – because git is installed in my /home/
-
to get things working, I had to use to following clone command :
git clone -u /home/bin/git-upload-pack user@server.com:mygitfolder
-
same versions of git on local machine/remote server (1.7.0.4)
so from what I can gather, I need to basically :
- find a way to either wrap my environment variable every time I push to the server
or - specify the path of my git-receive-pack while pushing to the server
I understand I could create a hook that would take effect as I push, but have not managed to find where/how this is implemented.
(I would rather not create an alias on my local machine)
If you can not adjust the effective PATH on the remote side1, then you will have to specify the location of the programs from your local side.
As you found,
git clonecan be given-u /path/to/git-upload-pack(or--upload-pack /path/to/git-upload-pack).git fetchandgit pullaccept--upload-pack /path/to/git-upload-pack(not-u, however, since it means something else to these programs). They also check theremote.<name>.uploadpackconfiguration variable.git pushaccepts--receive-pack /path/to/git-receive-packand checks theremote.<name>.receivepackconfiguration variable.Once you have your repository cloned, you can use the configuration variables to record the paths:
Then you can push, fetch, or pull without having to specify the path.
1
You said that “environment variables [are] blocked for SSH accounts”. If you mean that the sshd has its
PermitUserEnvironmentsetting turned off (meaning that you can not useenvironment="PATH=/home/bin:/usr/bin:/bin"in your.ssh/authorized_keysfile), then you still might be able to modify your default PATH via a shell initialization file (e.g..bashrc).