Github使用教程(详细图文)

一、安装Git for Windows

下载地址: https://git-for-windows.github.io/
在官方下载完后,安装到Windows Explorer integration的时候,将选项中将“Git Bash here”和“Git GUI here”打对勾。
Github使用教程(详细图文)
然后就一直next直到Finish

二、GitHub的使用

1.在需要上传的文件所长文件夹下右键选择Git Bash Here

Github使用教程(详细图文)

2.输入git init 初始化仓库

Github使用教程(详细图文)

3.输入git status 查看当前状态

Github使用教程(详细图文)

4.输入git add “文件名.后缀(如zip)” 上传文件

Github使用教程(详细图文)
再次输入git status 可以看到准备上传的文件
Github使用教程(详细图文)

5.输入git commit -m “更新的信息” 来提交

Github使用教程(详细图文)

6.输入git log 可以查看提交日志

Github使用教程(详细图文)

三、Git与GitHub关联使用:

1.注册与配置

到github 官网注册(如果已经注册过就直接登录)
本地配置用户名和邮箱
Git Base 设置——输入:
git config --global user.name “你的用户名”
git config --global user.email “你的邮箱”

2.生成ssh key

输入: ssh-****** -t rsa -C “你的邮箱”
Github使用教程(详细图文)
输入 clip < ~/.ssh/id_rsa.pub 会自动复制ssh key,可以直接粘贴
Github使用教程(详细图文)

3、连接github

打开GitHub 进入setting找到ssh key并新建
Github使用教程(详细图文)
Github使用教程(详细图文)
Github使用教程(详细图文)
Github使用教程(详细图文)
然后测试连接是否成功

输入: ssh -T [email protected]
Github使用教程(详细图文)
连接成功

4.本地连接到GitHub上面的仓库

登录GitHub 新建个仓库(如果已经建好就跳过此步骤)
Github使用教程(详细图文)
Github使用教程(详细图文)
Github使用教程(详细图文)

5.本地关联GitHub

输入 git remote add origin 你复制的地址
Github使用教程(详细图文)
如果出现fatal: remote origin already exists
则先输入 git remote rm origin 再关联
Github使用教程(详细图文)

6.上传文件

输入 git push -u origin master
Github使用教程(详细图文)
刷新GitHub界面 看到文件
Github使用教程(详细图文)
以后如果想更新文件到github 提交完后输入 git push就可以同步了

参考资料:https://blog.csdn.net/qazwsxpcm/article/details/68946736