通过ssh找不到包

Chr*_*ris 6 ssh bundler

如果我作为部署用户ssh进入我的VPS并运行bundle -v我得到Bundler version 1.1.5的预期.

如果我跑ssh deployment@123.123.123.123 bundle -v,那我明白了bash: bundle: command not found

为什么没有通过ssh显示运行命令的bundle?

更多信息

$ cat ~/.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

if [ -d "${RBENV_ROOT}" ]; then
  export PATH="${RBENV_ROOT}/bin:${PATH}"
  eval "$(rbenv init -)"
fi

# If not running interactively, don't do anything
[ -z "$PS1" ] && return
Run Code Online (Sandbox Code Playgroud)

lar*_*sks 3

当你跑步时:

ssh deployment@123.123.123.123
Run Code Online (Sandbox Code Playgroud)

您在远程主机上获得一个登录 shell,这意味着您的 shell 将运行(...对于 bash...).bash_profile.profile等效的以及每个 shell 初始化文件。

当你跑步时:

ssh deployment@123.123.123.123 some_command
Run Code Online (Sandbox Code Playgroud)

这不会启动登录 shell,因此它只运行每个 shell 的初始化文件(例如,.bashrc)。

您描述的问题通常意味着您需要.profile文件中的某些内容(通常是环境变量设置)才能使所有内容正常工作。