Git uses sshkey password-free login

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.