GitHub的使用

环境准备

创建仓库

生成token

目前的github上传,不在支持密码,需要使用token

生成本地密钥

ssh-keygen -t rsa -C "email"

查看生成的密钥

将密钥添加到github

代码拉取、推送

初始化本地仓库

git init

将远端仓库与本地仓库链接起来

添加远程配置

git remote add origin https://github.com/\<username>/<repo>.git

git remote set-url origin https://\<your_token\>@github.com/\<username>/<repo>.git

  • <your_token>:刚刚生成的token
  • <username>:github的用户名
  • <repo>:仓库名称

将当前目录下的所有修改过的文件添加到 Git 的暂存区

git add .

绑定邮箱和用户名(先输入下面的第一次创建时的代码)

第一次创建时

git config --global user.name "你的用户名"

git config --global user.email "你的邮箱"

要修改时

git config --replace-all user.name "你的用户名"

git config --replace-all user.email "你的邮箱"

查看当前仓库配置信息

git config --list

查看全局配置信息

git config --global -l

按q退出

将暂存区中的修改提交到本地仓库,并添加提交信息

git commit -m "test"

将当前分支重命名为 main

git branch -M main

拉取分支

git pull --rebase origin main

将本地 main 分支推送到远程仓库,并设置该分支的上游(upstream)跟踪关系

git push --set-upstream origin main

推送

git push

github加速

win自带的商店里面直接搜索Watt Toolkit安装

相关推荐
微学AI19 小时前
把 GitHub Issue 的“第一轮脏活”交给 AI:Issue AI Agent 接入蓝耘元生代实战
人工智能·github·issue
阳墨余21 小时前
Git 同时管理 Gitee 和 GitHub 的 SSH 配置实战
git·gitee·github
小弥儿1 天前
GitHub今日热榜 | 2026-08-16:大模型微调与编码工具扎堆
学习·开源·github
starp1 天前
skill 管理,后缀为public可以被git commit
github
31535669131 天前
DeepSeek Harness 发布后,我没急着跑 Demo,先把 `.agents/` 翻了一遍
前端·后端·github
u1301301 天前
GitHub 热榜项目:周榜(2026-08-16)
github
暮云星影2 天前
git版本发布
git·gitee·github·gitea
m4Rk_2 天前
【论文阅读】Agent 记忆机制(41):Agentic Plan Caching——将历史执行轨迹转化为可复用的计划记忆
论文阅读·人工智能·学习·开源·github
本地化文档2 天前
poethepoet-docs-l10n
python·github·gitcode·sphinx