账号与 Profile
creating-account、profile-readme、campus-program。
25 分钟
账号与 Profile
GitHub 账号不仅是登录凭证,也是你的开发者名片:Profile README、贡献日历、Campus 学生包都会影响协作时的第一印象。本课对应 git-github 路线图 的 creating-account、profile-readme 节点。
本地 Git 身份在 git-essentials 里用 user.name / user.email 配置;GitHub 侧还要处理 SSH、2FA 与公开资料。
学习目标
- 完成 GitHub 注册与基础安全设置(2FA、邮箱验证)
- 创建 Profile README(
用户名/用户名特殊仓库) - 了解 GitHub Campus / Student Developer Pack 申请入口
注册与安全
- 访问 github.com 注册,用户名建议与职业邮箱、域名一致
- Settings → Emails:验证主邮箱;勾选 Keep my email addresses private 可隐藏真实邮箱
- Settings → Password and authentication:开启 2FA(TOTP 或安全密钥)
- Settings → SSH and GPG keys:添加本机公钥,避免每次 HTTPS 输密码
# 生成 SSH 密钥(Windows Git Bash / macOS / Linux 通用)
ssh-keygen -t ed25519 -C "your_email@example.com"
# 启动 agent 并添加私钥
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# 复制公钥到剪贴板后粘贴到 GitHub
cat ~/.ssh/id_ed25519.pub
测试连接:
ssh -T git@github.com
# Hi username! You've successfully authenticated...
Profile README
创建与用户名同名的公开仓库,例如用户 alice 则仓库 alice/alice,根目录放 README.md,内容会显示在个人主页顶部。
# Hi, I'm Alice 👋
- 🔭 正在学 [git-github-essentials](/tracks/git-github-essentials)
- 📫 联系我:alice@example.com
- 🗺️ 进度:[git-github 路线图](/roadmaps/git-github)
可加入 GitHub 统计卡片、技能徽章;保持简洁,避免自动刷新外部 API 拖慢加载。
Campus 与学生福利
在校邮箱可申请 GitHub Education:Copilot 试用、域名券、云额度等。路径:Settings → Billing and plans → GitHub Education。非学生可跳过,不影响本 track 学习。
本地 Git 与 GitHub 账号对齐
git config --global user.name "Alice"
git config --global user.email "12345678+alice@users.noreply.github.com"
使用 GitHub 提供的 noreply 邮箱可关联 commit 与账号,同时保护隐私。