Mac system git generates SSH public key
When using Git repository for code management, the new computer often needs to generate SSH public key to match, Mac system generated git public key process is as follows:
1. Check if the machine has a public key
Enter the following command in the terminal:
?
2. If the computer has a previously left key, delete it
Use the following command:
?
123 |
$ mkdir key_backup $ cp id_rsa* key_backup $ rm id_rsa* |
3. Generate a new public key
Enter the following command in the terminal
?
1 |
$ ssh -keygen -t rsa -C "邮箱地址" |
After the terminal will be prompted several times the password settings, if the password is set, in the Git repository for code interaction with the need to type a password, you can also return all the time, indicating that no password is required.
4. Import the public key into the Git repository
Using the LS command under the. SSH folder to view all the files, you can see that a id_rsa.pub file is generated, open it with the VI tool, copy its contents, create a new public key in the Git repository, and copy it up. For example, the import key process in GitHub is as follows:
Transferred from: http://my.oschina.net/u/2340880/blog/658594
Mac system git generates SSH public key