一、创建 github 官网账号
二、安装 git 工具
git 工具下载地址,选择适合电脑 windows 的版本
三、新建仓库
点击右上角 + 号,New repository
然后输入必要的信息:
我这里已我使用 pygame 写的五子棋为例
Repository name --Gobang
Description Using --Using python pygame to create a small game
Public or Private --Public
等
当填写完毕时,你会得到如下界面,里面的命令行就是需要用到的
## 使用如下命令创建新仓库
…or create a new repository on the command line
echo "# Gobang" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/GuoQuanhao/Gobang.git
git push -u origin master
## 使用如下命令传入已有的仓库
…or push an existing repository from the command line
git remote add origin https://github.com/GuoQuanhao/Gobang.git
git push -u origin master
## 使用如下命令从另一仓库导入代码
…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
四、编辑文件
进入你要上传的文件夹
编辑 LICENSE 文件与 README 文件,LICENSE 主要写处版权,归属,作者等,README 主要写用法什么的,随自己
五、开始上传
右键 → Git Bash Here,因为我们是创建新仓库,对照上面给的 命令行,输入如下
git init
git add *
git commit -m "first commit"
git remote add origin https://github.com/GuoQuanhao/Gobang.git
git push -u origin master
期间会输入用户名跟密码,由于我以前上传过并记住密码,所以不需要输入密码
界面如下
六、上传成功
上传完成就能看见你的文件
注意事项
命令行的输入禁忌复制粘贴,否则会报错 bash: $’\302\226git’: command not found