Files
DailyChallenge_ProgrammingD…/Day_0/README.md
T

56 lines
2.6 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.
# Day_0 · Git 入门与 Hello World(第零节)
> 预计耗时:20~30 分钟
> 这一节不写任何难代码,只做三件事:**会用 Git、会克隆仓库、会提交作业**。
## 今日知识点
Git 是一个**代码版本管理工具**。今天只需要掌握四个动作:
- `git clone`:把远程仓库复制到你的电脑
- `git add`:把改动"登记"进暂存区
- `git commit`:把暂存区的内容"存成本地记录"
- `git push`:把本地记录**上传**到远程仓库(**需要仓库写权限**)
> 注意:这个仓库属于爱特工作室(组织),**只有组织成员能 push**。
> 你们平时交作业**不用 push**,而是把代码/截图贴在**对应日期的工单评论**里——和游戏部每日一题一样。
> 所以今天 push 失败不要慌,这不是你的问题,按下面的任务走就对了。
## 先学(教程)
- 菜鸟教程 Git:https://www.runoob.com/git/git-tutorial.html
- B站(零基础保姆级,看 1~6 讲即可:核心概念 / 区域 / 远程仓库):https://www.bilibili.com/video/BV1wJ4m1u7te/
- 备选(含 GitLab 上手,和我们用的平台很像):https://www.bilibili.com/video/BV1Bcm4BWE2c/
## 任务(后做)
1. 安装 Git:https://git-scm.com/download/win ,一路默认下一步
2. 打开命令行(Windows 按 Win+R 输入 `cmd`),运行 `git --version`,看到版本号即成功
3. 注册/登录 https://git.itouc.cn (用你的真实姓名,学长要认人)
4. 克隆本仓库到本地(命令见仓库页面 Code → Clone 的 HTTPS 地址):
```
git clone https://git.itouc.cn/ITStudio_OUC/DailyChallenge_ProgrammingDepartment.git
```
5. 进入仓库文件夹,新建文件 `hello.py`,文件内容**直接写**(一个字符都不要错):
```python
print("Hello World")
```
6. 在命令行体验 Git 的完整本地流程:
```
git add hello.py
git commit -m "add hello world"
```
这两步**一定会成功**。然后运行 `git push`——大概率会提示没有权限被拒绝,**这很正常**,
看一眼报错长什么样,记住这种感觉即可,不要纠结。
7. 运行你的程序:`python hello.py`,看到输出 `Hello World`
## 完成标准
- [ ] `git --version` 有版本号输出
- [ ] `python hello.py` 输出 `Hello World`
- [ ] `git add` + `git commit` 成功执行
- [ ] 能说出来:clone / add / commit / push 分别做了什么,以及 push 为什么不能用
**提交方式**:在 **Day_0 工单**(本仓库 Issues 里的第一个)下方"撰写"处,
贴上 `hello.py` 的代码内容 + 运行输出的**截图**,然后点击"评论"。