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
相关推荐
miofly26 分钟前
GitHub 今日推荐|gpu-unlock-ada:Ada 显卡张量算力翻倍解锁
开源·github
miofly2 小时前
GitHub 周榜趋势速报 | 2026-10-25
开源·github
miofly2 小时前
GitHub 日榜趋势速报 | 2026-10-25
开源·github
u1301303 小时前
GitHub 热榜项目:日榜(2026-10-24)
人工智能·github·1024程序员节
保卫大狮兄11 小时前
2小时,我搭了一套仓库出入库管理系统:收货、领料、退料、库存全打通!
wms·github·仓库·入库
沙蒿同学11 小时前
不引 Ghostscript:我用纯 Go 给 PDF 做了一场「压缩手术」
前端·后端·github
wflynn16 小时前
GitHub 日榜趋势速报 | 2026-10-23
开源·github
miofly17 小时前
Anthropic开源MHS标准,让AI智能体直接操作实验室硬件
开源·github
m4Rk_18 小时前
【论文阅读】Agent记忆机制(109):MemComposer——用强化学习学会选哪些记忆、选多少以及怎样排序
论文阅读·人工智能·学习·开源·github
Orange Wu19 小时前
GitHub SSH 443 端口配置解决连接失败
github