工具下载、安装及汉化
-
工具清单
工具准备
下载地址:
-
选择下载对应版本的工具和语言包
TortoiseGit和语言包下载页面
-
运行安装完成后,在桌面空白处点击鼠标右键,会显示Git菜单,请选择TortoiseGit > Settings。
Git设置
- 选择语言中文
语言包设置
基础信息设置
- 桌面空白处点击鼠标右键,会显示Git菜单,请选择 TortoiseGit > Settings。
- 选择Git,配置用户信息中的姓名和Email
Git用户信息配置
创建Git仓库
- 在需要交给Git管理的文件夹上右击鼠标,选择 Git 在这里创建版本库
Git创建版本库
- 接着会显示以下画面。不要勾选 制作纯版本库,请直接点击 确定。
- 创建Git仓库成功。
提交内容到Git仓库
- 进入Git仓库目录,新建一个 helloGit.txt 的文本文件。
新建文本文件
-
右击任意空白地方,然后从右击菜单选择‘Git提交’。
Git提交
- 填写 日志信息 ,勾选待提交的文件。
填日志,提交文件
-
提交成功。
提交成功
5.提交成功后会出现绿色的小勾。
提交成功
Git工作原理 / 流程

Workspace:工作区
Index / Stage:暂存区
Repository:仓库区(或本地仓库)
Remote:远程仓库
将本地仓库的内容提交到远程仓库
1. 创建SSH Key
在用户主目录下,看看有没有.ssh(C:\Users\Administrator.ssh)目录,如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Git Bash,创建SSH Key:
$ ssh-keygen -t rsa -C "youremail@example.com"
邮箱替换成自己的邮箱,然后一路回车就可以了,安全级别不是很高,可以不用设置密码。


2. 注册GitHub账号,设置SSH Key
登陆GitHub,点击自己的头像,打开“settings”,“SSH and GPG keys”页面

点“New SSH Key”,填上任意Title,在Key文本框里粘贴id_rsa.pub文件的内容:

3. 从本地仓库提交内容到GitHub远程仓库
切换到本地Git仓库目录
$ cd d:/myGitHub
将本地Git仓库添加到远程GitHub仓库
$ git remote add origin git@github.com:iceeye/myGitHub.git
把本地库的所有内容推送到远程库上
$ git push -u origin master

尝试把远程仓库内容拉到本地仓库
git pull origin master


最后只能强制推送到远程仓库
$ git push -u origin master -f

至此本地仓库所有内容均成功推送到远程GitHub仓库

网友评论