guides/git/start.md

30 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

开始使用 git
===
## 1. 安装
* 安装 `git` 客户端和图形界面(例如 `TortoiseGit``SmartGit`),连接方式注意选择 `openssh`
* 生成 `ssh 密钥`Windows 用户请先打开 `git bash`),输入命令:
```bash
ssh-keygen -t rsa -b 4096 -C "改成你的邮箱"
```
生成的密钥文件在 `~/.ssh` 文件夹下,其中 `id_rsa` 是私钥,请注意保密;`id_rsa.pub` 是公钥,无需保密,可放在需要使用的服务器上。
延伸阅读:[非对称加密](https://zhuanlan.zhihu.com/p/49494990)
* 打开 [设置](https://git.yztiot.com/user/settings/keys),上传公钥,才能连接远众 git 仓库。
## 2. Git 使用
### 2.1. 版本控制
[入门 - 工作就像玩游戏](http://www-cs-students.stanford.edu/~blynn/gitmagic/intl/zh_cn/ch01.html)
[Git Magic](https://github.com/blynn/gitmagic)
### 2.2. Git 基本操作
* 基本时序
![](start/sequence.webp)
* 常用命令
![](start/daily-commands.jpg)
[Git和SVN(Subversion)的命令的对比](https://www.jianshu.com/p/9c5d2a0589fc)
[Git 小游戏](https://learngitbranching.js.org/?locale=zh_CN)