Windows git multi-account configuration, multiple Ssh-key management on the same computer

Source: Internet
Author: User
Tags using git

This article is an extension of the previous article, "git-tortoisegit complete configuration Process" , so you need to know about the previous article, of course, you can directly look down, and some of the basic operations mentioned.

"Git-tortoisegit Complete configuration Process": http://www.cnblogs.com/popfisher/p/5466174.html.

This article is to configure the github.com account and git.oschina.net account to step through the configuration of git multi-account support in the Windows environment on the same computer Manage multiple Ssh-keyand learn more about Git.

Note: This article all executes the command place is in the administrator mode, namely opens the cmd,git Bash client to run the program with the administrator identity.

1. Generate github.com corresponding private key (file address C:\Users\popfisher directory)

Execute command ssh-keygen-t rsa-c email to create GitHub corresponding Sshkey, named id_rsa_github, password 123456

Ssh-keygen 774232122@qq. com

2. The same way to produce git.oschina.net private key (the mailbox address can be the same, the same as this article)

Execute command ssh-keygen-t rsa-c email to create GitHub corresponding Sshkey, named id_rsa_oschina, password 123456

Ssh-keygen 774232122@qq. com

3. Copy the above-mentioned files to the. SSH directory that git has accessed by default (win10 in the user directory, this article C:\Users\popfisher.ssh)

In addition to the key file, theconfig file is manually produced in a later step, and theknown_hosts file is subsequently automatically produced

4. Upload the public key corresponding to GitHub and Oschina to the server the way GitHub adds SSH keys is as follows:

git.oschina.net the way to add SSH key is as follows:

5. Create a config text file in the. SSH directory and complete the relevant configuration (the most important place )

Each account is configured with a single host, each host to take an alias, each host configuration HostName and identityfile two properties can be

The name of the Host can be the name you like, but this will affect GIT-related commands, such as:
Host mygithub This definition, the command is as follows, [email protected] immediately after the name changed to Mygithub
git clone [email protected]Mygithub:P opfisher/androidrotateanim.git

HostName This is the real domain address.
Identityfile , this is Id_rsa's address.
preferredauthentications indicates a match to the server public key
user defines username

config file is configured as follows:
   # configuration github.com                       host   github.com   HostName   github.com   identityfile   c:\\users\\popfisher\\.  ssh  \\id_rsa_github preferredauthentications publickey User yuzhangsheng  # configuration GIT.O Schina.net  host  git.oschina.net   HostName   git.oschina.net   identityfile   c:\\users\\popfisher\\ . ssh  \\id_rsa_oschina preferredauthentications publickey User yuzhangsheng   

6. Open the Git bash client (run as Administrator) to test whether the test is configured successfully (automatically generate the Known_hosts file in the. SSH directory to configure the private key)

7. After the test is successful, you can use Git to operate simultaneously on the computer, without affecting the Clone project on GitHub Androidrotateanim

Open the Androidrotateanim project on GitHub and copy its corresponding clone command as shown in

execute the Clone command as follows:

Project Androiddevtools on clone oschina.net

Open the androiddevtools item on the git.oschina.net, and copy its corresponding clone command as shown in

execute the Clone command as follows:

Learning Experience

In the process of using git, generally only focus on the situation of single account, the work of the configuration is directly from their superiors to send a configuration document and so on, and then on the line, but when they really have this demand, suddenly found helpless. I myself was in this situation, one day at home, suddenly found that they need a computer to support multiple SSH key when only to find that they do not know how to do, so decided to do their own research. For technology, or to do hands-on practice, the practice of things to form their own truth, it is not so easy to forget.

This article is based on the practice of WIND10 platform, because of limited knowledge, may not be summed up very complete, may also encounter some other problems on other platforms, there is no time to study, if the reader has encountered any problems, welcome message discussion, study together.

Windows git multi-account configuration, multiple Ssh-key management on the same computer

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.