-1

The agency I work for have a Codebase account that I sometimes need to work with at home, but I have just setup a Codebase account for my freelance work, too.

However, I keep getting permission errors when pushing up to the repo because my ssh config file now has two codebasehq.com hosts to point to.

How can I set this up so I can pull & push to two separate repos on two separate accounts?

Thanks, Jay

1
  • Thanks! ssh-add ~/.ssh/work_rsa was the command I needed! Commented Jul 4, 2016 at 20:13

1 Answer 1

0

You can construct a SSH config file using many parameters and different approaches.

The format for the alias entries use in this example is:

Host alias 
  HostName <host1> 
  IdentityFile ~/.ssh/identity

To create a config file for two identities (workid and personalid), you would do the following:

Open a terminal window.
Edit the ~/.ssh/config file. 

If you don't have a config file, create one.
Add an alias for each identity combination for example:

Host workid
HostName <host1>
IdentityFile ~/.ssh/workid

Host personalid
HostName <host2>
IdentityFile ~/.ssh/personalid

PS

Don't forget to load the keys to your server.

Sign up to request clarification or add additional context in comments.

3 Comments

The issue I'm having is that both of the Hostnames are codebasehq.com and they're both pointing towards their separate Identiyfiles yet I can't seem to push to the work one since I've setup my personal one this evening. Thanks though!
I had this side of it all set up correctly, I just had to use ssh-add ~/.ssh/work_rsa to get it working. Thanks!
Sure np. tying to help. you can also do this: eval $(ssh-agent)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.