github使用记录

1. 首次上传本地项目到 GitHub

1.1 准备 GitHub 仓库

复制代码
登录 GitHub,点击右上角 + → New repository

输入仓库名称(建议与本地目录同名)

选择公开(Public)或私有(Private)

不要勾选 "Initialize this repository with a README"

点击创建

1.2 初始化本地仓库

复制代码
# 进入项目目录
cd /path/to/your/project

# 初始化Git仓库
git init

# 添加所有文件到暂存区
git add .

# 提交更改(添加注释)
git commit -m "Initial commit"

1.3 添加远程仓库

复制代码
# 添加远程仓库(替换username和reponame)
git remote add origin https://github.com/<username>/<reponame>.git

1.4 添加令牌访问远程仓库

复制代码
git remote set-url origin https://<token>@github.com/<username>/<reponame>.git

## token:创建好的令牌号
## 参考: https://blog.csdn.net/weixin_44415582/article/details/131503585

1.5 推送代码

复制代码
# 首次推送需要指定上游分支
git push -u origin main

如果push不上,可以添加代理端口:
参考:https://blog.csdn.net/weixin_43914200/article/details/121316043
相关推荐
zandy10111 小时前
【全新 3.0版本】openclaw github installation guide
github·openclaw·installation
Freak嵌入式1 小时前
MicroPython LVGL基础知识和概念:时序与动态效果
开发语言·python·github·php·gui·lvgl·micropython
北冥有羽Victoria2 小时前
OpenCLI 操作网页 从0到1完整实操指南
vscode·爬虫·python·github·api·ai编程·opencli
Thomas.Sir3 小时前
GitHub Copilot从入门到精通【从基础补全到智能代理,解锁AI编程全技能】
github·copilot·ai编程
Hhaizhr3 小时前
Hermes Agent频频超时?一招教你解决API网络连通问题
github
Renlijuande3 小时前
VSCode + GitHub Copilot + C语言环境(MinGW)配置攻略(2026版)
vscode·github·copilot
AI成长日志4 小时前
【GitHub开源项目专栏】TGI源码剖析:HuggingFace推理服务核心实现
开源·github
GISer_Jing4 小时前
AI Weekly | 2026年4月第二周 · GitHub热门项目与AI发展趋势深度解析
人工智能·github
代码搬运媛4 小时前
Open Core 模式:开源版与企业版的双仓库管理实践
github
AI精钢4 小时前
升级踩坑实录:OpenClaw 2026.4.9 后 GitHub Copilot 调用 Claude 全线 HTTP 400 的根因与修复
http·github·copilot·claude·github copilot·openclaw·ai 网关