SSH configuration for multiple git accounts

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.