Can I add a New ssh account in cloud9

workspace

#1

I have existing SSH servers which works fine.
Actually, I have two accounts in the GitHub and I want to create a New workspace to connect the other github account
I found that the account will be rollback to the old account when I resigned in the could9,even if I change the id_rsa and id_rsa.pub.
Now my solution to write a script to replace the file of id_rsa and id_rsa.pub everytime ,but I think it is not a good way to solve it
what’more ,even I did the above solution .The github shows the contributions belongs to the older account when I using the new account
Do you have any solution to solve my problem? Thanks in advance


#2

save your new key with a different name, say ~/.ssh/github_rsa
and change ~/.ssh/config file to have IdentityFile ~/.ssh/github_rsa


#3

I have tried it ,How can I choose one account to push my code ? or it will push code twice to each account ?
thanks ~


#4

the code in ~/.ssh/config

Host github.com
  User git
  Port 22
  Hostname github.com
  IdentityFile ~/.ssh/github_rsa
  ...

tells git to use ~/.ssh/github_rsa when pushing to github.com.

the account name shown in github is determined when commiting the code, not when pushing.
It is configured in ~/.gitconfig

[user]
        name = yourname
        email = your@email.com

you can either edit that file to change username and email for all repositories on that workspace, or run

git config user.name newname
git config user.email new@email

to change them for one repostiory only

or it will push code twice to each account ?

git push won’t push code twice.