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
相关推荐
miofly11 小时前
百度开源ERNIE 5.5 Flash Base,总参数280B仅激活14B
开源·github
dong_junshuai12 小时前
每天一个开源项目#154 Nushell:结构化管道怎样跨过文本边界
github
Jason_gao99917 小时前
Github Copilot 新手极速上手指南
人工智能·github·copilot
GitHub实测笔记17 小时前
hexyl 本机实测:8MiB 转储中位 102ms、od 696ms(约 6.8×);默认双面板,NO_COLOR 下要 --color=force
github
MoRay17 小时前
放弃云端 Computer Use,我用 Python 手搓了一个带“物理防呆”的本地 GUI Agent 底座
python·github
用户29914221968017 小时前
GitHub 热榜项目:日榜(2026-11-07)
人工智能·开源·github
miofly21 小时前
GitHub 日榜趋势速报 | 2026-11-07
开源·github
miofly1 天前
Inkling 2 Small 发布,基准测试大幅超越前代但不敌同级对手
开源·github
dong_junshuai2 天前
每天一个开源项目#153 LZ4:用块边界和有序并行换取低延迟
github
Qiongkura2 天前
开源自荐:CodeYear:把本机 Git 历史变成年度代码手账(本地优先 · 零上传 · 已上 PyPI)
github