Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have:

Computer A with id_rsa and id_rsa.pub

Computer B with different id_rsa and id_rsa.pub (it's not the same as that one from computer A) and id_rsa2 id_rsa2.pub

I created an account on heroku, with id_rsa.pub from machine A. Now I try to pull a project on machine B, so i tried to add id_rsa.pub from machine B. Unfortunately, some time ago I used it in another Heroku project (with another account) and I can't use it in this one. So I added id_rsa2.pub, and it's valid. But heroku git:clone still tries to use id_rsa instead of id_rsa2. How can I force it?

share|improve this question

migrated from stackoverflow.com Mar 23 '13 at 19:22

This question came from our site for professional and enthusiast programmers.

the solution is to define local different domains locally in your machine, this is done by

adding the following to you ~/.ssh/config file

Host heroku.personal
  HostName heroku.com
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes
Host heroku.work
  HostName heroku.com
  IdentityFile ~/.ssh/work_rsa
  IdentitiesOnly yes

now you can clone the project using git clone git@heroku.work:your-app-name.git note that heroku.work is used instead of heroku.com

now we need to change .git/config in the project to cause any further git commands to use the new url

note that url in the file /path/to/your/app/.git/config is set to the url that you used in git clone command

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.