git + bitbucket - ssh 脚本问题

git + bitbucket - ssh script issues

关于使用 ssh 的 Bitbucket 指南提供了一个脚本,我已将其添加到 bashrc,但是当它 运行s 时它只是自动说已连接而不是请求密码。当我运行

ssh-add -l

我收到消息 "The agent has no identities."

我在 windows,我设置了 .ssh 目录,它有配置、环境和 known_host 文件。此外,我在这里放置了一个 KEYS 目录,其中包含生成的 ssh 密钥。

环境和known_host生成了,但是我自己创建了配置, 它仅包含以下内容

Host bitbucket.org
 IdentityFile ~/.ssh/KEYS/theMachine

不知道环境文件数据是什么意思,暂时post就不说了。

我关注的指南位于此处:

https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html

我已经完成了第 6 步,但我卡在了第 4 步。

您将密钥存储在不同的地方,因此 ssh-add 无法找到它(它不会读取您的配置 -- 教程不太好)。

您应该将 ~/.ssh/KEYS/theMachine 移至 ~/.ssh/id_rsa。是的。并将 ~/.ssh/KEYS/theMachine.pub 也移动到 ~/.ssh/id_rsa.pub。它会解决你的问题。


另一种解决方案是将 ~/.bashrc 中的行修改为

/usr/bin/ssh-add

/usr/bin/ssh-add ~/.ssh/KEYS/theMachine

The agent has no identities.

有关详细信息,请阅读此 For Unix, what are ssh-agent and ssh-add, and how do I use them?


按照这些步骤开始并添加您的 ssh 密钥和代理。

# start the ssh agent service
eval $(ssh-agent)

# your keys should now be automatically loaded from the ~/.ssh folder
# but just in case to verify that they were loaded:
ssh-add