Git SSH configuration, eliminating the pain of filling in user name and password

Source: Internet
Author: User
Tags ssh
git config ssh

tags (space delimited): git

1. Set git's user name and email: (If it's the first time)

$ git config--global user.name "weiguobing" 
$ git config--global user.email "guobingwei@aliyun.com"

2. Generate key

$ ssh-keygen-t rsa-c "Humingx@yeah.net"

3 consecutive carriage returns. If you don't need a password.
Finally, two files were obtained: Id_rsa and id_rsa.pub.

3. Add encryption Key to Ssh-agent

Make sure that the ssh-agent is available. Ssh-agent is a program that controls the private key used to hold public key authentication, in fact Ssh-agent is a key manager, after running ssh-agent, use Ssh-add to give the private key to ssh-agent custody, Other programs that require authentication can pass the validation request to Ssh-agent to complete the certification process.

Start the ssh-agent in the background 
eval "$ (ssh-agent-s)" 
Agent PID 59566

Add the generated SSH key to Ssh-agent.
$ Ssh-add ~/.ssh/id_rsa

4. Login to GitHub and add ssh.

5. Test:
$ ssh-t git@github.com

6. Modify the URL of the. git folder under CONFIG.
Before modification:

[remote "origin"]
 url = https://github.com/humingx/humingx.github.io.git
    fetch = +refs/heads/*:refs/remotes/origin/*

After modification:

[remote "origin"]
url = git@git.oschina.net:humingx/humingx.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*

It's done.

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.