In general, git only needs to maintain a default Git account to conquer.
But if you do need multiple git accounts, it's necessary to configure multiple SSH keys.
To generate multiple SSH keys first
Ssh-keygen " [email protected] "
Enter the saved file name such as Id_rsa_github in the shell interaction, and the secret key (optional)
For example, you can generate a corresponding SSH key for GitHub, BitBucket, and your own company.
By default, the ~/.ssh directory does not have a config file, you need to manually add a
CD ~/. SSH Touch Config
Configure config file to add rules
Host github.comhostname github.comuser gitpreferredauthentications publickeyidentityfile ~/.ssh/id_rsa_githubHost Bitbucket.orghostname bitbucket.orguser gitpreferredauthentications publickeyidentityfile ~/.ssh/id_rsa_ Buckethost git.company.comHostName git.company.comUser gitpreferredauthentications publickeyidentityfile ~/.ssh/id_ Rsa_company
In this way, you can use different SSH authentication on different git servers.
Reference Links:
Http://stackoverflow.com/questions/3225862/multiple-github-accounts-ssh-config
http://code.tutsplus.com/tutorials/quick-tip-how-to-work-with-github-and-multiple-accounts--net-22574
SSH configuration for multiple git accounts