git-upload-pack: command not found

后端 未结 5 769
孤城傲影
孤城傲影 2020-12-25 13:19

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

5条回答
  •  北海茫月
    2020-12-25 13:44

    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:

    PermitUserEnvironment yes
    

    Then just create .ssh/ directory and dump envronment to .ssh/enviroment:

    cd ~/
    mkdir .ssh
    env > .ssh/environment
    

    Restart SSH

    /etc/init.d/sshd restart
    

    Now when you do this from your local machine:

    ssh you@server.com  "which git-upload-pack"
    

    you s'd get

    /usr/local/bin/git-upload-pack
    

    and git clone s'd work.

提交回复
热议问题