Linux下配置GitHub

一、注册GitHub账号

二、在linux命令行输入

git config --global user.name "YOUR NAME" #配置github账号
git config --global user.email "YOUR EMAIL ADDRESS" #配置github邮箱

三、生成SSH keygen

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"  
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]  #ssh文件的保存路径
Enter passphrase (empty for no passphrase): [Type a passphrase]  #ssh的密码
# Enter same passphrase again: [Type passphrase again]
Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com

四、添加ssh key到ssh-agent

eval $(ssh-agent -s)  #确认ssh-agent可用
# Agent pid 59566
ssh-add ~/.ssh/id_rsa  #添加ssh key到ssh-agent
vi ~/.ssh/id_rsa.pub  #复制文件内的key

五、到github账户后台→settings→SSH and GPG keys→New SSH key→将复制的key复制并保存

六、测试ssh连通性

ssh -T git@github.com   #连接github
The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?  #选择yes
Hi username! You've successfully authenticated, but GitHub does not  #ssh连接成功
# provide shell access.

七、下载github上的项目

git clone git@github.com:jquery/jquery.git
原文地址:https://www.cnblogs.com/rhjeans/p/4798027.html