废话不多说,我们开始
1.下载Git

2.安装Git的步骤
这个相信大家都会,就不详细说了,跟着提示点下一步就好
3.注册Github账号(已有账号则忽略这一步)
注册好以后点击NEW 新建一个新的储存库


点Create repository以后会出现以下页面(可以做命令参考)

echo "# ataoli" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/Github账号名/ataoli.git
git push -u origin main
4.以上步骤完成以后打开Git Bash

5.ssh协议搭建本地仓库
1. 打开git bush 生成ssh公钥和私钥对
ssh-keygen -t rsa -C ‘xxx@xxx.com’ //-C 参数是你的邮箱地址
.ssh文件可能是隐藏文件
然后在:C盘/用户/Administrator目录下寻找.ssh目录下的id_rsa_pub文件,然后复制出来

打开github,找到Profile Settings–>SSH Keys—>Add SSH Key,并把上一步中复制的内容粘贴到Key所对应的文本框,在Title对应的文本框中给这个sshkey设置一个名字,点击Add key按钮

- 添加完成后,可以使用如下命令检查是否成功。(gitee不需要这一步)
$ ssh -T git@github.com
Hi taoli! You've successfully authenticated, but GitHub does not provide shell access.
2. 然后在打开Git bash输入个人信息(代码提交者)
git config --global user.name "xxxx" // github用户名
git config --global user.email xxxxx@qq.com // github注册时的邮箱
3. 关联远程仓库地址
git remote add origin 你远程仓库的URL
在自己电脑上的随便一个盘创建一个本地目录的仓库,这里博主创建在c盘
输入git init 以后会自动创建一个本地仓库

把自己想上传的代码放到本地仓库目录下
放到目录下以后开始第一次的远程push
第一步:git add *\n
第二步:git commit -m ""

上面的全部输入了以后,进行最后一步
git push -u origin maser
备注:第一次提交需要带-u,后期提交可以不带,因为第一次提交的仓库是空的
第一次提交会出现此页面,点击Sign in

然后出现下面这个页面,按页面提示输入你的GitHub账号登陆即可

完成上述以后,再次输入git push -u origin maser
出现以下页面则恭喜上传成功
