bash ssh-agent:无法打开与您的身份验证代理的连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48017345/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ssh-agent: Could not open a connection to your authentication agent
提问by Tsiruan
I have done a ton of research already, but none of those works. This is output from my terminal:
我已经做了大量的研究,但没有一个奏效。这是我终端的输出:
$ ps aux | grep ssh-agent
tsiruan 4080 0.0 0.0 13468 388 ? Ss 11:47 0:00 ssh-agent
$ env | grep SSH
SSH_AUTH_SOCK=/tmp/ssh-8CJH68abyLAa/agent.4079
SSH_AGENT_PID=4080
$ sudo ssh-add .ssh/bitbucket_ssh
[sudo] password for tsiruan:
Could not open a connection to your authentication agent.
I have tried $ eval $(ssh-agent)
with backticks, single quote, double quote, with and without parentheses, with and without -s option, and even some answers like:
我尝试过$ eval $(ssh-agent)
使用反引号、单引号、双引号、带和不带括号、带和不带 -s 选项,甚至一些答案,例如:
$ exec ssh-agent bash
please help me , I am running bash on arch linux.
请帮助我,我在 arch linux 上运行 bash。
回答by Charles Duffy
First Choice: Don't Use sudo
第一选择:不使用 sudo
ssh-add .ssh/bitbucket_ssh
Second Choice: Pass The Environment Variable Explicitly
第二种选择:显式传递环境变量
Assuming your bitbucket_ssh
file is only readable by root -- the more appropriate approach is to fix the permissions, but as an interim approach, you can pass SSH_AUTH_SOCK
through:
假设您的bitbucket_ssh
文件只能被 root 读取——更合适的方法是修复权限,但作为一种临时方法,您可以SSH_AUTH_SOCK
通过:
sudo env SSH_AUTH_SOCK="$SSH_AUTH_SOCK" ssh-add .ssh/bitbucket_ssh