Git安装与配置

安装Git


转:https://blog.****.net/qq_23341529/article/details/79331519

下载地址:https://git-scm.com/ 

Git安装与配置

 

 

 

[此后一路NEXT即可] 

 

 

 

配置账户信息

打开cmd或powershell,输入

git config --global user.name "liuhuanHappyStudy" //绿色部分为GitHub用户名

git config --global user.email [email protected] //这里用GitHub的注册邮箱

创建本地ssh

打开cmd或powershell,输入

ssh-****** -t rsa -C "[email protected]" //此处“C”要大写,邮箱使用GitHub注册邮箱

 

输入后中间会提示选择生产ssh-key路径以及设置密码,一路回车跳过即可 

 

将ssh配置到GitHub

Git安装与配置

生成ssh-key后命令行会提示保存的路径。如上图。 

我们找到这个路径下的id_rsa.pub并用文本编辑软件打开 

(以下为示例)

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1HsFXD5Wsx26kVdRR67e8RqxucPag+6x6SgoKrvCTDRZcU2fZ5ymYPRFyRv9bKo75rr7EX6h/HhQWXpHUqlT6iuVm2BDV8lwLGdBOlvxLBShQ64dBsqZZyyKOjiAZz5Zy2WuDmbBGjkOEBaNF8DUEOcQEKJtRm4Xt4DziJqfCOWvLPb9YCCIgP1raMaCasq3A3c+8wnSWnGy5u1ayx9Q//ypcJZ8MvrCRaNwbnWsUdTYTq6dmAd1pCr1y+GW6f2uLSH9Em1b7TymJWINIHwrSyav5a0izB7x6PcrGsWi5yAMORKAI9cfXWjW7viHdrekf7xIwXUC9PSzdJusmHx3H [email protected]

 

复制该文件内所有文本内容 

登录GitHub,点击Settings——SSH and GPG keys——点击右侧Add SSH key 如下图 

Git安装与配置

Title随意,将所复制内容粘贴至Key 

Git安装与配置

 

 

测试是否成功: 

打开Git Bash终端(不是命令行或Powershell)输入

ssh -T [email protected]

1

返回如下信息表示成功

The authenticity of host 'github.com (192.30.255.112)' an't be established.

RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRoTxdCARLviKw6E5SY8.

Are you sure you want to continue connecting (yes/no)? es

Warning: Permanently added 'github.com,192.30.255.112' RSA) to the list of known hosts.

Hi coiggahou! You've successfully authenticated, but GiHub does not provide shell access.https://blog.****.net/qq_23341529/article/details/79331519