There was an error when I submitted the code yesterday, which was baffling. Because I usually submit the code through HTTPS, Google found that I could submit the code through SSH, so I set the SSH of the computer and added it to Github to solve the problem. Here is how to configure SSH.
1. Set your own firstuser.name
和user.email
git config --global user.name "yourName"
git config --global user.email "yourEmail"
Copy the code
2. Generate a key
ssh-keygen -t rsa -C "yourEmail"
Copy the code
You will be asked to enter key as follows:
![](http://cloud.mo4tech.com/images/ADNyEzL39iMvIzdllmVldWYtl2Q3UCcpJHdz9CduVWay9WLvRXdh9iMyd2bNV2Zh1Wa-cmbw5iN3YjYkF2NykTZmBjMmJDMtkDO4QDN3EzLzV2Zh1WafRWYvxGc19ybp5SdoNnbhlmauMXZnFWbp1CZh9GbwV3LvoDc0RHa/72af89d22286d4656071250ae4792b28.png)
We could just ignore it and just have three enter keys.
Generate two files: id_rsa and id_rsa.pub in c:/user/ username /.ssh/
3. Add the key tossh-agent
Ensure that the Ssh-agent is available. Ssh-agent is a program that controls the private key used for public key authentication. In fact, ssh-agentt is a key manager. After running the ssh-Agent, run the ssh-add command to deliver the private key to the ssh-Agent for safekeeping. When other programs need authentication, they can submit the authentication request to the SSH-Agent to complete the authentication process. perform
eval "$(ssh-agent -s)"
Copy the code
Get the following information
Agent pid 59566
Copy the code
4. Log on to your GitHub Setting
Find and open the id_rsa.pub file under c:/user/ username /.ssh/.
![](http://cloud.mo4tech.com/images/ADNyEzL39iMvIzdllmVldWYtl2Q3UCcpJHdz9CduVWay9WLvRXdh9iMyd2bNV2Zh1Wa-cmbw5yM1IDN5QjM5UDNjJmMiZzYtkDO4QDN3EzLzV2Zh1WafRWYvxGc19ybp5SdoNnbhlmauMXZnFWbp1CZh9GbwV3LvoDc0RHa/aa635a20ce73d7cf6936e315b5cb635c.png)
5. Check whether the configuration is successful
ssh -T [email protected]
Copy the code
If present:
Hi humingx! You've successfully authenticated, but GitHub does not provide shell access.
Copy the code
The configuration is successful.
Then change the URL below.git/condig in the project to SSH and you can happily commit the code.