无法在 EC2 Ubuntu 实例中使用 git ssh 连接到 bitbucket

Not able to connect to bitbucket using git ssh in EC2 Ubuntu instance

我正在尝试在 ubuntu EC2 实例上使用 SSH 连接 git。

我尝试了以下步骤,但出现 public 键错误。

帮我解决这个错误。

注意:我尝试了以下解决方案,但没有用。 git push origin master: permission denied (public key) error

注意(更新)::它在我的本地机器(windows)中使用 SSH 密钥工作。

您可能需要更改密钥和文件夹的权限。

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

您可能还需要更改主目录的权限并删除组和其他人的写入权限。

chmod go-w ~

This帮我回答了你的问题。

我尝试了以下解决方案,它有效。

sudo su - root  # switch to root user
cat ~/.ssh/id_rsa.pub  # create if not already existing
sudo su - ubuntu  # switch back to normal user

引用自Unable to add ssh-key of EC2 instance to bitbucket account