GIT : “git-upload-pack: command not found” while pushing to remote server

前端 未结 1 1218
野性不改
野性不改 2021-01-02 03:25

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 SS
相关标签:
1条回答
  • 2021-01-02 04:07

    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 clone can be given -u /path/to/git-upload-pack (or --upload-pack /path/to/git-upload-pack).

    git fetch and git pull accept --upload-pack /path/to/git-upload-pack (not -u, however, since it means something else to these programs). They also check the remote.<name>.uploadpack configuration variable.

    git push accepts --receive-pack /path/to/git-receive-pack and checks the remote.<name>.receivepack configuration variable.

    Once you have your repository cloned, you can use the configuration variables to record the paths:

    git clone -u /home/bin/git-upload-pack user@server.com:mygitfolder
    cd mygitfolder
    git config remote.origin.uploadpack /home/bin/git-upload-pack
    git config remote.origin.receivepack /home/bin/git-receive-pack
    

    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 PermitUserEnvironment setting turned off (meaning that you can not use environment="PATH=/home/bin:/usr/bin:/bin" in your .ssh/authorized_keys file), then you still might be able to modify your default PATH via a shell initialization file (e.g. .bashrc).

    0 讨论(0)
提交回复
热议问题