Git安装将项目上传到GitHub

安装Git

国内镜像下载
去找一个下载就行了
安装都是默认下一步就ok了

操作Git

首先打开Git Bash
鼠标右键就可以看到了

然后设置账户和密码

$ git config --global user.name  "you name"
$ git config --global user.email "your email"

在这里插入图片描述

然后生成SSH秘钥

$ ssh-keygen -t rsa -C "you email"

在这里插入图片描述
生成后的秘钥一般在C:\Users\Administrator.ssh里面
在这里插入图片描述
用记事本打开id_rsa.pub,全部复制
然后返回到github里面打开设置
在这里插入图片描述
新添加一个SSH keys
在这里插入图片描述
将上面复制的内容添加进去
在这里插入图片描述
然后继续进行操作
创建本地仓库

$ git init

在然后选择文件添加到临时库
可以用 . 表示全部 也可以指定名字

$ git add . 

然后为要提交的数据描述

$ git commit -m 'readme.txt提交' 

在这里插入图片描述
接下来继续

$ git branch -M main

然后获取github的仓库的路径
在这里插入图片描述

$ git remote add origin https://github.com/dhsb-4/test.git

在这里插入图片描述

最后一步,提交到github仓库

$ git push -u origin main

当你执行这一步的时候千万要小心,由于2021-08-13出现的一个,个人访问令牌,所以它会弹出三个框
第一个框:让你填写自己的个人访问令牌
第二个框:填写用户名
第三个框:写着让你填写密码,但是其实要你填写个人访问令牌,不要在用登陆的密码了,要用个人访问令牌。不然会报以下错误

fatal: An error occurred while sending the request.
fatal: The request was aborted: Could not create SSL/TLS secure channel.
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/dhsb-4/test.git/'

这样ok了
在这里插入图片描述

个人访问令牌

在这里插入图片描述
找到这个
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值