git-upload-pack: command not found

后端 未结 5 776
孤城傲影
孤城傲影 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:39

    My solution for this problem

    1. Check path for the git-upload-pack on your remote machine:

      ssh yourname@IP-addressORdomain 'which git-upload-pack'
      

    If it gives a path - copy it (without git-upload-pack and trailing slash. Examples: /usr/bin, /home/yourname/bin, /whatever/gituploadpack/path, etc.).

    1. Check your PATH on the remote machine during login shell:

      ssh yourname@IP-addressORdomain 'echo $PATH'
      

    There is no such a path (/whatever/gituploadpack/path), is not it? Good!

    1. Login to your remote machine:

      ssh yourname@IP-addressORdomain
      
    2. Open .bashrc_profile:

      nano /home/yourname/.bashrc_profile
      
    3. Find these lines if any:

      if [ -f ~/.bashrc ]; then
           ~/.bashrc
      fi
      

    ...and change them for:

        if [ -f ~/.bashrc ]; then
            source ~/.bashrc
        fi
    
    1. Open .bashrc:

      nano /home/yourname/.bashrc
      
    2. Add these 4 lines:

      if [ -d "/whatever/gituploadpack/path" ] ; then
        PATH="$PATH:/whatever/gituploadpack/path"
      fi
      export PATH
      
    3. Exit the remote machine:

      exit
      
    4. Check your PATH on the remote machine during login shell:

      ssh yourname@IP-addressORdomain 'echo $PATH'
      

    Do you see /whatever/gituploadpack/path? Congrats!

    Note now you've solved not only git-upload-pack problem but also git-receive-pack and other executables on your /whatever/gituploadpack/path!

提交回复
热议问题