博主的Git服务器上git安装路径是“/opt/bin/git-receive-pack”,不是默认路径,需要在Git服务器建立软链接。
解决方案:
使用root用户登录服务器,
首先,执行“which git-receive-pack”查看“git-receive-pack”命令所在路径:
root@MyCloudPR4100 home # which git-receive-pack
/opt/bin/git-receive-pack
然后通过执行下面的命令,可以在 /usr/bin/ 目录下创建“git-receive-pack”的软链接:
ln -s /opt/bin/git-receive-pack /usr/bin/git-receive-pack
“git-upload-pack” 同理。
注意:
有时候上述方法仍然无效(比如,在/usr/bin目录下执行“./git-receive-pack”会提示“./git-receive-pack: not found”),此时需要删除/usr/bin目录下已有的软链接,再重新执行上面的创建软链接的命令!!!!!!