There is an SSH key on a computer that submits the code on GitHub for other reasons
you might be able to submit it to a different github on a single computer.
If you have an SSH key on your computer, if you have a default one, generate the second one directly.
One, build and add the first SSH key
$ ssh-keygen-t rsa-c "[Email protected]"
execute the command in GIT bash all the way to the return, generate Id_rsa and id_rsa.pub two files in the ~/.ssh/directory
Open content in id_rsa.pub with a text editor and add SSH Keys to GitHub
Do not understand, please refer to GitHub create SSH Keys
Ii. generate and add a second SSH key
$ ssh-keygen-t rsa-c "[Email protected]"
don't go all the way this time, give this file a name or the default is to overwrite the first generated
If the name is my, the directory structure is as follows:
If the resulting second SSH key is not in the. ssh/, you can move to this directory
The contents of the config file created under. ssh/are as follows:
Host github.com HostName github.com preferredauthentications publickey identityfile ~/.ssh/id_rsahost my.github.com HostName github.com preferredauthentications publickey identityfile ~/.ssh/my
The host name is optional and will be used next.
Iv. test configuration is correct
If Hi xxx! appears You ' ve successfully authenticated the connection is successful
Different approaches are now given in the following scenarios:
1. Local has been created or has been clone to Local:
There are two workarounds:
Open a. git/config file
The #my.github.com in the URL in the #更改 [remote origin] item corresponds to the Host[remote "origin" configured above]url = [email protected]:itmyline/blog.git
or modify the remote when you commit in Git bash
$ git remote rm origin$ git remote add origin [email protected]:itmyline/blog.git
2, the clone warehouse corresponding configuration Host Account
#my. github.com corresponds to an account git clone [email protected]:username/repo.git
Itmyhome
SSH key switching for multiple github accounts