bitbucketに公開鍵を登録してもPermission denied (publickey). fatal: The remote end hung up unexpectedlyと言われ続けるとき

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

ssh-addというのが必要らしい。

$ ssh-add ~/.ssh/id_rsa.bitbucket.org

してみると、

Could not open a connection to your authentication agent.

というエラーが出た。

調べてみると、次のコマンドをまず打たないといけないとのこと。
http://funkaoshi.com/blog/could-not-open-a-connection-to-your-authentication-agent

$ eval "$(ssh-agent)"

Agent pid 6990

そのあとで

$ ssh-add ~/.ssh/id_rsa.bitbucket.org
Identity added: /home/ec2-user/.ssh/id_rsa.bitbucket.org (/home/ec2-user/.ssh/id_rsa.bitbucket.org)