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
相关推荐
wflynn6 小时前
GitHub 日榜趋势速报 | 2026-11-27
开源·github
一条Go8 小时前
全链路 e2e:一次跑出 20 个现象,收敛成 5 个根因
后端·github·测试
一条Go8 小时前
开源新生代雷达 · 第 24 期
github
钱栈up12 小时前
GitHub 热榜上手|anthropics/skills:18.9万星的 Claude 技能库
python·开源·github
李永奉19 小时前
Git和GitHub-VS Code 图形化 Git 放弃更改、暂存与取消暂存、撤销上一次提交(VS Code 界面操作 + 命令行对照)
git·github
TunerT_TQ1 天前
【开源 L3 静态取证|工程评测】xnulinux:双内核实验——可复现的环境与许可比截图更重要
github
一条Go1 天前
proto 契约:校验注解、错误码与「文案即接口」
后端·github
一条Go1 天前
15 套品牌色 + 双模式:把颜色关进三层 token
前端·github
逛逛GitHub1 天前
GitHub 上 1.6 万 Star!这个 GitHub 项目让 AI 帮你复刻视频
github
秋千易1 天前
Agent 用不了 Skill,卡在 5 个断点
github