Day_0 · 注册 GitHub,把 Hello World 推送到自己的仓库(第零节) #1

Open
opened 2026-08-22 17:26:33 +08:00 by shimmer · 47 comments
Owner

题目与教程详见仓库对应目录 Day_0/README.md(本仓库已克隆即得)。

预计耗时:25~30 分钟
今天做四件事:注册 GitHub、建自己的仓库、用命令行把代码推上去、在工单里交仓库地址。
推送的目标是你自己的 GitHub 仓库,不是工作室的仓库(工作室仓库只有学长能 push)。

今日知识点

Git 是代码版本管理工具,GitHub 是存放代码的网站。今天掌握这些命令:

命令 作用
git init 把当前文件夹变成 Git 仓库
git status 查看当前状态(改了哪些文件)
git add hello.py 把文件"登记"进暂存区(git add . 表示全部)
git commit -m "说明" 把暂存区内容存成本地记录
git branch -M main 把默认分支命名为 main
git remote add origin <仓库地址> 关联远程仓库(origin 是它的名字)
git push -u origin main 首次推送到远程(-u 记住关联,之后直接 git push)

先学(教程)

任务(后做)

  1. 注册 GitHub 账号:打开 https://github.com → Sign up,用真实信息注册(免费),记住你的用户名
  2. 创建个人仓库:右上角 + → New repository → 仓库名填 hello-daily-challenge
    → 选 Public → 点 Create repository(不要在页面上勾选任何初始化选项,保持空仓库)
  3. 在电脑上新建文件夹 hello-daily-challenge,在里面新建 hello.py,
    文件内容直接写(一个字符都不要错):
    print("Hello World")
    
  4. 在该文件夹里打开命令行,依次执行:
    git init
    git add .
    git commit -m "add hello world"
    git branch -M main
    git remote add origin https://github.com/你的用户名/hello-daily-challenge.git
    git push -u origin main
    

    git remote add 那行,把"你的用户名"换成你注册时用的用户名。

  5. 推送时命令行会问用户名和密码,这样填:
    • 用户名:你的 GitHub 用户名
    • 密码:不是登录密码,而是 Personal Access Token(怎么生成看第 6 步)
  6. 生成 Token(密钥):GitHub 网页 → 点头像 → Settings → 拉到最下面
    Developer settings → Personal access tokens → Tokens (classic) → Generate new token (classic)
    → 勾选 repo 权限 → Generate → 复制那串 token(只显示一次)
  7. 刷新 https://github.com/你的用户名/hello-daily-challenge ,确认 hello.py 出现了
  8. 运行验证:命令行 python hello.py,看到输出 Hello World

卡壳求助:任何一步报错,把完整报错文字贴在 Day_0 工单里,学长会帮你。
常见坑:用户名拼错、token 没勾 repo 权限、文件夹没先 git init。
GitHub 打不开/推送超时:先看上面"GitHub 稳定访问方法"那篇教程,多半是网络问题,不是你的操作问题。

完成标准

  • GitHub 账号已注册
  • 个人仓库 hello-daily-challenge 里有 hello.py
  • python hello.py 输出 Hello World
  • 能说出来:add / commit / push 分别做了什么

提交方式:在 Day_0 工单下方"撰写"处,贴上你的 GitHub 仓库地址
(形如 https://github.com/你的用户名/hello-daily-challenge),然后点击"评论"。

> 题目与教程详见仓库对应目录 Day_0/README.md(本仓库已克隆即得)。 > 预计耗时:25~30 分钟 > 今天做四件事:**注册 GitHub、建自己的仓库、用命令行把代码推上去、在工单里交仓库地址**。 > 推送的目标是你**自己的 GitHub 仓库**,不是工作室的仓库(工作室仓库只有学长能 push)。 ## 今日知识点 Git 是**代码版本管理工具**,GitHub 是存放代码的网站。今天掌握这些命令: | 命令 | 作用 | | --- | --- | | `git init` | 把当前文件夹变成 Git 仓库 | | `git status` | 查看当前状态(改了哪些文件) | | `git add hello.py` | 把文件"登记"进暂存区(`git add .` 表示全部) | | `git commit -m "说明"` | 把暂存区内容存成本地记录 | | `git branch -M main` | 把默认分支命名为 `main` | | `git remote add origin <仓库地址>` | 关联远程仓库(`origin` 是它的名字) | | `git push -u origin main` | 首次推送到远程(`-u` 记住关联,之后直接 `git push`) | ## 先学(教程) - 廖雪峰 Git 教程(重点看"远程仓库"和"添加远程库",我们和教程做一模一样的事):https://liaoxuefeng.com/books/git/remote/ - GitHub 官方文档·推送提交到远程仓库:https://docs.github.com/zh/get-started/using-git/pushing-commits-to-a-remote-repository - 菜鸟教程 Git 基础:https://www.runoob.com/git/git-tutorial.html - **GitHub 稳定访问方法**(国内打不开 GitHub / 推送超时 / 网页访问失败时,按这篇操作):https://zhuanlan.zhihu.com/p/1946180155610469521 ## 任务(后做) 1. **注册 GitHub 账号**:打开 https://github.com → Sign up,用真实信息注册(免费),记住你的**用户名** 2. **创建个人仓库**:右上角 `+` → New repository → 仓库名填 `hello-daily-challenge` → 选 Public → 点 Create repository(**不要在页面上勾选任何初始化选项**,保持空仓库) 3. 在电脑上新建文件夹 `hello-daily-challenge`,在里面新建 `hello.py`, 文件内容**直接写**(一个字符都不要错): ```python print("Hello World") ``` 4. 在该文件夹里打开命令行,依次执行: ``` git init git add . git commit -m "add hello world" git branch -M main git remote add origin https://github.com/你的用户名/hello-daily-challenge.git git push -u origin main ``` > `git remote add` 那行,把"你的用户名"换成你注册时用的用户名。 5. 推送时命令行会问用户名和密码,这样填: - 用户名:你的 GitHub 用户名 - 密码:**不是登录密码**,而是 Personal Access Token(怎么生成看第 6 步) 6. **生成 Token(密钥)**:GitHub 网页 → 点头像 → Settings → 拉到最下面 Developer settings → Personal access tokens → Tokens (classic) → Generate new token (classic) → 勾选 `repo` 权限 → Generate → **复制那串 token**(只显示一次) 7. 刷新 https://github.com/你的用户名/hello-daily-challenge ,确认 `hello.py` 出现了 8. 运行验证:命令行 `python hello.py`,看到输出 `Hello World` > 卡壳求助:任何一步报错,把**完整报错文字**贴在 Day_0 工单里,学长会帮你。 > 常见坑:用户名拼错、token 没勾 repo 权限、文件夹没先 `git init`。 > GitHub 打不开/推送超时:先看上面"GitHub 稳定访问方法"那篇教程,多半是网络问题,不是你的操作问题。 ## 完成标准 - [ ] GitHub 账号已注册 - [ ] 个人仓库 `hello-daily-challenge` 里有 `hello.py` - [ ] `python hello.py` 输出 `Hello World` - [ ] 能说出来:add / commit / push 分别做了什么 **提交方式**:在 **Day_0 工单**下方"撰写"处,贴上你的 **GitHub 仓库地址** (形如 `https://github.com/你的用户名/hello-daily-challenge`),然后点击"评论"。
shimmer changed title from Day_0 · Git 入门与 Hello World(第零节) to Day_0 · 注册 GitHub,把 Hello World 推送到自己的仓库(第零节) 2026-08-22 21:33:14 +08:00
https://github.com/RorschachHe/hello-daily-challenge
https://github.com/wyn-netizen/hello-daily-challenge
https://github.com/FinaleQuill/hello-daily-challenge
https://github.com/wang-zi-kun/hello-daily-challenge
https://github.com/[321170123/hello-daily-challenge](https://github.com/321170123/hello-daily-challenge)
Member
https://github.com/arthur-lee-1/hello-daily-challenge
Owner

建议大家也同时在git.itouc.cn,在我们的git上创建仓库~

建议大家也同时在git.itouc.cn,在我们的git上创建仓库~
https://github.com/Q88a/hello-daily-challenge
https://github.com/yhk2007/hello-daily-challenge
https://github.com/huanmor/hello-daily-challenge
https://github.com/lyun69965/hello-daily-challenge
https://github.com/[Jxw2333-ouc/hello-daily-challenge](https://github.com/Jxw2333-ouc/hello-daily-challenge)
https://github.com/Xigua726/hello-daily-challenge
https://github.com/Udrys-lan/hello-daily-challenge
https://github.com/lzxzswzs/hello-daily-challenge
https://github.com/zxh2007/hello-daily-challenge
https://github.com/LIZARD912/hello-daily-challenge
https://github.com/Mirelle22/hello-daily-challenge
https://github.com/eoh3/hello-daily-challenge
https://github.com/lucky72-ai/daily_challenge
https://github.com/smithy223/hello-daily-challenge
https://github.com/ccy128-bot/hello-daily-challenge
https://github.com/2932785510/hello-daily-challenge
Owner
https://github.com/[qianliang-cpu/hello-daily-challenge](https://github.com/qianliang-cpu/hello-daily-challenge)
https://github.com/dengyichao666/hello-daily-challenge
https://github.com/Liaozihan337700/hello-daily-challenge
https://github.com/Alano-qyr/hello-daily-challenge
https://github.com/zrzz-maker/hello-daily-challenge
https://github.com/laity225/hello-daily-challenge
https://github.com/1wwwr/hello-daily-challenge
https://github.com/ouyangyuhang26/hello-daily-challenge
https://github.com/cr08230823/hello-daily-challenge
https://github.com/26-05/hello-daily-challenge
https://github.com/wutangmilktea/hello-daily-chanllenge
https://github.com/inkkni53213/hello-daily-challenge
https://github.com/silksnow136/hello-daily-challenge
https://github.com/[Explorers-s/hello-daily-challenge](https://github.com/Explorers-s/hello-daily-challenge)
https://github.com/He-Lufan/hello-daily-challenge
https://github.com/xhn789/hello-daily-challenge
https://github.com/Ffllamme/hello-daily-challenge
https://github.com/haibaraai84/hello-daily-challenge
https://github.com/YachiyoIrohaKaguya/hello-daily-challenge
https://github.com/Lyriand/hello-daily-challenge
https://github.com/KasakiMizuki/hello-daily-challenge
https://github.com/lelele555-png/hello-daily-challenge
https://github.com/xu675693517-hue/hello-daily-challenge
Sign in to join this conversation.