Reference from Blog: http://omiga.org/blog/archives/2269
The Hadoop environment is configured on the Ubuntu main account, and the folder ~/.ssh is configured with access to the local SSH key, but the account is configured with a access GitHub SSH key so this is required, as described in http://omiga.org/ "Multiple GitHub account Switching":
GitHub uses SSH to connect to the client. If you are a single user (a), when a key pair is generated, the public key is saved to GitHub, and the SSH client sends the local private key (the default ~/.ssh/id_rsa) to server-side authentication each time the connection is connected. In a single user case, the public key saved on the connected server and the private key sent are naturally paired. But if it is multi-user (First,second), we are connected to the second account, second save their own public key, but the SSH client still sends the default private key, that is, the private key of the, then the validation will not pass.
However, to achieve multiple account under the SSH key switch on the client to do some configuration.
First, the CD to ~/.SSH uses Ssh-keygen-t-rsa-c ' second@mail.com ' to generate a new SSH Key:id_rsa_second, which adds the new SSH public key to the GitHub when it is finished.
Ssh-keygen-t rsa-c ' second@mail.com ' default SSH only reads Id_rsa, so in order for SSH to recognize the new private key, it needs to be added to the SSH agent Ssh-add ~/.ssh/id_rsa_second
If the command complains: could not open a connection to your authentication agent. Unable to connect to the SSH agent, you can execute the ssh-agent Bash command and then execute the ssh-add command. After completing the previous steps, create a config file in the ~/.ssh directory, which is used to configure the server for the private key. Reads as follows: # Default GitHub User (first@mail.com) Host github.com HostName github.com user git identityfile c:/users/username /.ssh/id_rsa # Second User (second@mail.com) Host github-second HostName github.com user git identityfile c:/users/user
Name/.ssh/id_rsa_second host at will, to facilitate their own memory, the follow-up in the addition of remote is still need to use. When the configuration is complete, when connecting to a GitHub warehouse with a Non-default account, the address of the remote library should be modified accordingly, for example, now add the second accountA warehouse test, you need to add this: Git remote add Test git@github-second:second/test.git #并非原来的git @github. com:second/test.git This will use Id_rsa_second to connect to the server each time the connection is made.
So far, done.
Note: GitHub According to the configuration file User.email to get GitHub account display author information, so for multiple account users must remember to change user.email to the corresponding email (second@mail.com). Reference GitHub Help Documentation: http://help.github.com/win-set-up-git/http://help.github.com/multiple-ssh-keys/
Original address: http://omiga.org/blog/archives/2269
I will follow the gourd, the default account in the file to access the local Hadoop ssh to localhost,hostname change to localhost, so that you can create multiple SSH keys under the same Ubuntu account.