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
相关推荐
一条Go1 小时前
边缘 Agent:为什么是它连出来,而不是平台连进去
后端·架构·github
一条Go1 小时前
开源新生代雷达 · 第 15 期
github
OpenTiny社区2 小时前
我用Vue 100%复制DeepSeek开源的网页App,代码更少,功能还更多!
前端·vue.js·github
Bigger3 小时前
我扒了 GitHub Trending 前 20,8 个在做同一件事:给 Coding Agent 造基础设施
开源·github·ai编程
徐小夕4 小时前
MedDoc AI:把临床书写、协作、质控、知识问答装进一个工作台
前端·vue.js·github
cong_5 小时前
🐟 我把摸鱼岛重写了!现在群聊还能装进一张表格
前端·后端·github
wflynn5 小时前
GitHub 今日推荐|rust-anything:录制真实输入输出,渐进式重写热点函数到 Rust
rust·开源·github·cli·claude-code·agent-skills
wflynn6 小时前
GitHub 日榜趋势速报 | 2026-11-17
开源·github
敢敢是只喵i20 小时前
OpenAPI 里有两个 quantity,审批规则到底在比哪个?
github
七分辣度20 小时前
GitHub/Git 常用命令及使用场景
git·github