我已经使用这个 bitbucket 教程来提供对 git repo 的 ssh 访问:https ://confluence.atlassian.com/pages/viewpage.action?pageId=270827678
但是现在每次我想使用 git 时,它都会说我没有权限,直到我这样做:
ssh-agent /bin/bash
&&
ssh-add ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
为什么会这样?我在我的本地机器上很容易做到了,但是远程服务器不能正常工作。
更新
当我做
ssh-agent
Run Code Online (Sandbox Code Playgroud)
我明白了
SSH_AUTH_SOCK=/tmp/ssh-blGr6z5dJjit/agent.14183; export SSH_AUTH_SOCK;
SSH_AGENT_PID=14184; export SSH_AGENT_PID;
echo Agent pid 14184;
Run Code Online (Sandbox Code Playgroud)
但比我尝试做 git fetch 时,我得到了这个:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
即使在我添加了密钥之后
ssh-add ~/.ssh/bitbucket
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud)