Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu ssh代理是';在本地运行命令时未加载_Ubuntu_Ssh_Ubuntu 18.04 - Fatal编程技术网

Ubuntu ssh代理是';在本地运行命令时未加载

Ubuntu ssh代理是';在本地运行命令时未加载,ubuntu,ssh,ubuntu-18.04,Ubuntu,Ssh,Ubuntu 18.04,我想将应用程序从我的Mac部署到我的ubutun 18.04服务器。问题是,当我转到服务器并执行ssh-T之类的简单命令时git@bitbucket.org一切正常。它没有问我的密码等等。。。 但是当我运行命令时 ssh deploy@ipofmyserver 'ssh -T git@bitbucket.org' ssh deploy@... 'eval `ssh-agent -s` && ssh-add && ssh -T git@bitbucket.org'

我想将应用程序从我的Mac部署到我的ubutun 18.04服务器。问题是,当我转到服务器并执行ssh-T之类的简单命令时git@bitbucket.org一切正常。它没有问我的密码等等。。。 但是当我运行命令时

ssh deploy@ipofmyserver 'ssh -T git@bitbucket.org'
ssh deploy@... 'eval `ssh-agent -s` && ssh-add && ssh -T git@bitbucket.org'
我有一个错误:

git@bitbucket.org:权限被拒绝(公钥)

我的ssh密钥已生成,并在我的bitbucket帐户中很好地通知

我注意到当我连接ssh时deploy@... 用户代理未启动。当我运行命令时

ssh deploy@ipofmyserver 'ssh -T git@bitbucket.org'
ssh deploy@... 'eval `ssh-agent -s` && ssh-add && ssh -T git@bitbucket.org'
它询问我的密码短语,我得到了我能够连接的回复。 我尝试使用这个解决方案来使用已经运行的用户代理:但它不起作用

有解决办法吗

我尝试使用这个解决方案来使用已经运行的用户代理:但它不起作用

如果如文件所述,您试图使用
。ssh在
~/.bashrc
~./.zshrc
中查找agent.sh
,这将不起作用

问题的核心(ssh内部的ssh)是[ssh会话将读取:

  • 在交互式会话中(不是
    .bashrc
  • 非交互式会话(
    ssh)中没有任何内容user@server“a命令”
您至少应该找到
.bash
rc
\u profile
)以触发
.ssh find agent.sh
,并查看它是否找到您的ssh代理(已在运行,已输入密码)

如果必须输入密码短语,则可能需要,如中所示

确认源文件
.profile
(而不是
.bash\u profile
)足以使
.ssh find agent.sh
工作


提到了,这里是一个动态的:

ssh -J deploy@ipfmyserver git@bitbucket.org 

感谢您的帮助。我在.bashrc中输入了源代码以触发.ssh-find-agent.sh,但它不起作用,但当我在.profile中输入源代码时,它就起作用了。感谢您的时间:)@jean max我已将您的评论包含在答案中以获得更多的可见性。
ssh-Jdeploy@ipfmyserver git@bitbucket.org
会更简单。