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
相关推荐
阿里嘎多学长15 小时前
2026-09-09 GitHub 热点项目精选
开发语言·程序员·github·代码托管
面包狗AI4S15 小时前
GitHub AI4S 项目观察(2026-08-28—2026-09-03)
github
GoGeekBaird16 小时前
从「跑完即销毁」到「用完再销毁」:云沙箱的一次进化
后端·github·ai编程
逛逛GitHub19 小时前
GitHub 又一个 3D 人体可视化项目,AI 能力提升催生新场景。
github
峰向AI19 小时前
多代理协作的正确姿势:Atlas让 Claude Code 和 Codex共享记忆
github
蜡台19 小时前
GitHub 关闭 Two‑factor authentication(2FA)
github
HaipengYu1 天前
Star History 凉凉?5 分钟部署一套属于自己的 GitHub 星标统计服务
github
理智.6291 天前
Git 工具使用之项目版本回退与修改备份:stash、reset、reflog 常用指令详解
git·gitee·github
尚雷55801 天前
避坑指南:从零搭建 openGauss oGRAC 双节点集群,这些细节要注意
github·ograc
TunerT_TQ1 天前
GitHub每日热评|用写HTML的方式生成确定性MP4:HeyGen开源的HyperFrames到底强在哪?
开源·github·资讯