-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

Jay
  • 326
  • 2
  • 18

1 Answers1

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.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 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! – Jay Jul 04 '16 at 20:11
  • 1
    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! – Jay Jul 04 '16 at 20:13
  • Sure np. tying to help. you can also do this: `eval $(ssh-agent)` – CodeWizard Jul 04 '16 at 20:28