1、下载安装Git
https://download.csdn.net/download/notfindjob/11451730?spm=1001.2014.3001.5503
2、注册一个github的账号(已经注册的,可略过这一步)
3、打开git命令行,配置github账号
|-----------------------------------------------|
| git config --global user.name "你的用户名"
|
|-------------------------------------------------------|
| git config --global user.email "你的github注册邮箱"
|

4、在github上建立一个新的代码库,在git命令行输入命令克隆代码库到本地(默认克隆到本地"""C:\Users\Administrator")
|--------------------------------------------------------|
| git clone https://github.com/你的用户名/你的代码库名称.git
|
5、使用Git GUI打开刚才克隆的本地代码库


6、在此代码库中添加文件,commit、push,会提示输入账号和密码

7、问题处理:
因为2021年8月13日之后,已经不支持https提交代码,故需要设置ssh方式
1)找到刚才克隆的本地代码库,在.git里边找到config文件。
2)修改config文件,将https修改为ssh方式,ssh后边的字段可以到github上复制


3) git配置账号、密码(第3步已经完成,可以略过),同步骤3
4)生成ssh证书
|-------------------------------------------|
| $ ssh-keygen -t ed25519 -C "你的邮箱"
|

5)下载并开启ssh代理服务器
https://download.csdn.net/download/notfindjob/89302323
错误处理:Could not open a connection to your authentication agent
a、说明是代理没有开启或者开启参数不对
|----------------------------------|
| $ eval "$(ssh-agent -s)"
|
|-------------------------------|
| ssh-add ~/.ssh/id_rsa
|

6)github中设置SSH密钥




a、生成公钥
ssh-keygen -t rsa -C "GitHub邮箱"
b、进入路径
vim ~/.ssh/id_rsa.pub
c、复制公钥到GitHub设置SSH and GPG keys中的SSH keys
d、解决方法:
第b步使用如下命令后复制
cat ~/.ssh/id_rsa.pub


8、重新push,大功告成
