Recently hosted on Oschina, projects on Oschina are managed with Git. One of the most troublesome parts of git is that every time the code is submitted, it requires the user name and password of the input Oschina to authenticate, which greatly affects the efficiency. Oschina provides a method for SSH key access, which simply adds a public key on the Oschina and uses the key locally to allow for password-free connection and reference tutorial.
First generate Sshkey with Ssh-keygen
Ssh-keygen-t rsa-c "[email protected]"-F "D:\id_rsa"
[Email protected] is a personal mailbox
D:\id_rsa is the generated Sshkey file
Next, you will be asked to enter the private key password, if you want to leave blank can press ENTER (enter)
Enter passphrase (empty for no passphrase): Enter same passphrase again:
When you are finished, you will be prompted with the following key values that may be different
The key fingerprint is:bf:3c:17:0b:16:31:86:bb:c4:f3:06:75:7d:83:72:78 [email protected]
Finally generate two files Id_rsa and id_rsa.pub, put these two files in the. ssh folder, Windows. SSH folder is generally under the user of the system disk (c:\users\)
Open id_rsa.pub with Notepad and add text to Oschina's public key list
Enter in Git bash
ssh-t [email protected]
return Welcome to [email protected], your name! Indicates that the addition was successful.
Precautions:
The generated Sshkey file must be named Id_rsa because SSH reads Id_rsa sshkey by default.
After completing the above configuration, the commit code still need to enter the user name and password, you can go to the local git repository. git\config file, if the URL is using the HTTPS protocol, instead of the GIT protocol.
Before modification
[Remote "origin"]url = Https://git.oschina.net/oschina/git-osc.gitfetch = +refs/heads/*:refs/remotes/origin/*
After modification
[Remote "origin"]url = [email Protected]:oschina/git-osc.gitfetch = +refs/heads/*:refs/remotes/origin/*
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Git uses sshkey password-free login