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
相关推荐
guuguo42 分钟前
【做个开源软件】Mac 上 node 进程莫名吃掉 6G 内存?给 AI / MCP 做了个深度归因和安全回收工具
人工智能·开源·github
一条Go2 小时前
源新生代雷达 · 第 16 期
github
一条Go2 小时前
SSH 命令审核流:为什么「能执行」必须先「被批准」
后端·架构·github
杨凯凡4 小时前
IT日报|2026-11-19:Oracle Java 紧急补丁、Optimizely 供应链攻击、GitHub 安全评估升级
java·oracle·github
徐小夕4 小时前
深度拆解 Design Agent:LangChain 出品,AI 设计从「好看」走向「可用」
前端·vue.js·github
严肃小白兔5 小时前
GitHub Copilot 团队级 Agent Plugins 正式发布:插件架构、共享配置与实战
github·copilot
狂师6 小时前
太强了!三周冲到8.6k+ Star,免Root 免电脑,Mika 在后台替你操作所有App
github·agent·测试
wflynn18 小时前
GitHub 日榜趋势速报 | 2026-11-18
开源·github
Hvitur19 小时前
Git - 多分支合并
git·github
laoyeye8311 天前
手写 vLLM 分页 KV Cache(三):引用计数、写时复制(CoW)与前缀缓存
人工智能·github