managing multiple ssh keys on heroku

前端 未结 1 485
一向
一向 2021-02-03 15:29

so I have a couple of ssh keys that are used for other accounts that I have. I now need to be able to clone a heroku repository on my computer. I created a new ssh key and used

相关标签:
1条回答
  • 2021-02-03 16:27

    I sometimes have to work with a bunch of heroku accounts, and have run into this. Here's what I usually do:

    • Clear identities

      $ ssh-add -D
      
    • ssh-add the key that I need for the current account

      $ ssh-add ~/.ssh/an_account_key
      
    • Now I can push to my heroku app

      $ git push heroku-remote master
      

    Of course, this assumes that the key has been added to the heroku account already. You can do that with:

    $ heroku keys:add
    

    The correct way to solve this is with an SSH configuration in ~/.ssh/config, but that's a bit much for me since I only switch accounts occasionally.

    Googling about the SSH configuration file should turn up plenty of results, but here's some that might help:

    • SSH config - same host but different keys and usernames
    • Specify an SSH key for git push for a given domain
    • Simplify Your Life With an SSH Config File
    0 讨论(0)
提交回复
热议问题