git配置github链接

1、百度git官网-下载最新版git

2、一路默认下一步安装

3、打开 git bash here 命令行

4、注册github账号(用自己的邮箱就可以,不会英文可以用谷歌翻译)注册成功后建立项目

5、根据项目起一个名字,建议勾选创建README 然后点击创建项目

6、配置git用户名以及邮箱

  $ git config --global user.name "Your Name"

  $ git config --global user.email "email@example.com"

7、设置与github的关联可用ssh

  查看本地目录C:Userszhangyifan下是否有.ssh文件(有的话删除)

  打开git命令行键入

  $ ssh-keygen -t rsa -C "your_email@youremail.com"  输入你的邮箱

Creates a new ssh key using the provided email # Generating public/private rsa key pair.

Enter file in which to save the key (/home/you/.ssh/id_rsa):


——————一路按回车

完了之后,大概是这样:

Your public key has been saved in /home/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@youremail.com

如果出现

ssh: connect to host github.com port 22: Connection timed out

在.ssh下面建立config文件,内容如下:注意congig无后缀名!

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

测试连接情况: ssh -T git@github.com输入yes

成功!



原文地址:https://www.cnblogs.com/breakyifan/p/9705602.html