You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Contributing to multiple accounts using SSH and multiple keys
105
+
106
+
If you are a member of an {% data variables.enterprise.prodname_emu_enterprise %}, but also want to collaborate outside your enterprise using a personal account, you can use different SSH keys for each account. For more information about using SSH, see [AUTOTITLE](/authentication/connecting-to-github-with-ssh).
107
+
> [!WARNING]
108
+
> You cannot use the same SSH key to contribute to both repositories inside your {% data variables.enterprise.prodname_emu_org %} and outside the enterprise.
109
+
110
+
1. Generate a different SSH key forthe repositoriesin your {% data variables.enterprise.prodname_emu_org %}. See [AUTOTITLE](/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key). When you save the key, give it a different filename from your existing key (for instance, add -emu to the suggested name of the file).
111
+
112
+
1. Add the new ssh key to your {% data variables.enterprise.prodname_managed_user %}. See [AUTOTITLE](/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account#adding-a-new-ssh-key-to-your-account)
113
+
114
+
1. Configure your SSH Config File `~/.ssh/config` to use the different keys. For example, if your personal SSH key is `~/.ssh/id_ed25519` and your {% data variables.enterprise.prodname_emu_enterprise %} SSH key is `~/.ssh/id_ed25519-emu`
115
+
116
+
```text copy
117
+
Host github.com
118
+
IdentityFile ~/.ssh/id_ed25519
119
+
IdentitiesOnly yes
120
+
121
+
Host github-emu.com
122
+
Hostname github.com
123
+
IdentityFile ~/.ssh/id_ed25519-emu
124
+
IdentitiesOnly yes
125
+
```
126
+
127
+
> [!NOTE]
128
+
> The `IdentitiesOnly` line ensures that if the ssh-agent has loaded multiple keys, ssh uses the correct key when connecting.
129
+
130
+
1. Test your SSH configuration by running the following command to connect using the SSH key associated with your personal account - see [AUTOTITLE](/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection) for further details
131
+
132
+
```shell copy
133
+
ssh -T git@github.com
134
+
```
135
+
136
+
Test to see if you can connect to ({% data variables.product.github %}) using your {% data variables.enterprise.prodname_emu_enterprise %} SSH key
137
+
138
+
```shell copy
139
+
ssh -T git@github-emu.com
140
+
```
141
+
142
+
1. Tell `git` to use the correct key when downloading or uploading a repository in an {% data variables.enterprise.prodname_emu_org %}.
143
+
To list the organizations in your {% data variables.enterprise.prodname_emu_enterprise %},
144
+
{% data reusables.profile.access_org %}
145
+
1. For each organization listed tell `git` to use the `github-emu.com` host.
146
+
147
+
For example, if one of your organizations is called `octocat-emu`then to tell `git` to use the host `github-emu.com`forrepositoriesin the `octocat-emu` organization, run the following command
Now, when you clone a repository using SSH, in the `octocat-emu` organization, `git` will use the SSH key associated with your {% data variables.enterprise.prodname_emu_enterprise %} instead of your personal key.
154
+
104
155
## Next steps
105
156
106
157
For reference information, see [AUTOTITLE](/account-and-profile/reference/personal-account-reference).
0 commit comments