默认已安装并配置了Git,安装配置见https://blog.csdn.net/q123_xi/article/details/100522605
方法一:在本地克隆仓库,将需要提交的文件移入克隆仓库时创建的本地目录。
一、创建GitHub repository
点击右上角头像->Your profile->Repositories->New;
自定义名字和描述,勾选Initialize this repository with a README;
二、在本地克隆仓库
根据提示下载Git-2.23.0-64-bit.exe,运行,点击Clone a repository,在URL选项中粘贴上图中的链接,自定义本地存储路径,点击Clone。
三、打开本地克隆仓库目录,将需要上传到GitHub的文件移入
4、选中本地克隆仓库文件夹,右击选中Git Bash Here
(1)将要提交的文件暂存到本地仓库
$ git add .
# Adds the file to your local repository and stages it for commit. 要取消暂存文件,请使用 'git reset HEAD YOUR-FILE'
(2)不必需
$ git pull origin master
$ git push origin master
(3)提交暂存在本地仓库中的文件
$ git commit -m "Add existing file"
# Commits the tracked changes and prepares them to be pushed to a remote repository. 要删除此提交并修改文件,请使用 'git reset --soft HEAD~1' 并再次提交和添加文件
(4)在本地仓库中推送更改到GitHub
$ git push origin master
# 或
$ git push origin your-branch
# 将本地仓库中的更改推送到指定为源的远程仓库