一、环境配置
1、Git下载
去git官网下载对应版本和系统的Git工具,Git安装时要注意最好勾选鼠标右键有Git bash和Git UI的选项
2、配置SSH密钥
本地和githup连接是通过SSH加密的,看本地C盘用户目录下有没有.ssh文件夹,有的话将id_rsa.pub里面的加密码复制到githup setting/SSH and GPG keys中,本地没有的话, 在git上执行ssh-keygen -t rsa -C “youremail@example.com”,然后再复制密码到githup的Key上。
二、Github上传本地项目
1、 github上创建repository
注意创建时勾选创建readme文件
2、上传本地项目到github
# git初始化
git init
# 添加本地所有文件
git add .
# 提交并打tag
git commit -m "add tensorrt"
# 和远程建立连接
git remote add origin XXXX(这里最好用SSH的链接)
# 注意,本地分支由master转为main,否则用master提交后在github上切换才能看见羡慕
git branch -m master main
#这报错:Updates were rejected because the remote contains work that you do
#not have locally.解决方法是先从github重pull readme文件
git pull --rebase origin main
#提交代码
git push -u origin main