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
相关推荐
玄同7651 小时前
Git常用命令指南
大数据·git·elasticsearch·gitee·github·团队开发·远程工作
吠品2 小时前
命令行揭示SSL证书真相
https·github·ssl
、BeYourself3 小时前
解决git@github.com: Permission denied (publickey)
github
十步杀一人_千里不留行4 小时前
Git提交前ESLint校验实践(Husky + lint-staged)
git·github
朱昆鹏5 小时前
开源 Claude Code + Codex + 面板 的未来vibecoding平台
前端·后端·github
猫头虎6 小时前
OpenClaw-VSCode:在 VS Code 里玩转 OpenClaw,远程管理+SSH 双剑合璧
ide·vscode·开源·ssh·github·aigc·ai编程
你听得到118 小时前
我彻底搞懂了 SSE,原来流式响应效果还能这么玩的?(附 JS/Dart 双端实战)
前端·面试·github
宁雨桥8 小时前
Gitee迁移GitHub开源全攻略:一键配置自动同步,仅需维护单一仓库
gitee·开源·github
掘金安东尼9 小时前
⏰前端周刊第 452 期(2026年2月2日-2月8日)
前端·javascript·github
CoderJia程序员甲9 小时前
GitHub 热榜项目 - 日榜(2026-02-08)
git·ai·开源·llm·github