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
相关推荐
七牛云行业应用2 小时前
Jev 报 401 / api_key_required 怎么解决:TypeSafe AI 官方错误码表与排查步骤
算法·github
誰能久伴不乏3 小时前
保姆级 GitHub 协作教程
github
miofly9 小时前
Claude 自主发现类 CRISPR 结构的新型逆转录酶系统:Anthropic 生命科学实验室的早期成果
开源·github
HelloGitHub11 小时前
《HelloGitHub》第 126 期
开源·github
miofly11 小时前
GitHub 日榜趋势速报 | 2026-09-28
开源·github
miofly16 小时前
GitHub 日榜趋势速报 | 2026-09-27
开源·github
怕浪猫16 小时前
顶级模型一句话,AI 写出了能玩的 QQ飞车
前端·面试·github
粥里有勺糖16 小时前
视野修炼-技术周刊第134期 | 豆豆眼头像
前端·github·aigc
粥里有勺糖17 小时前
体验一下最近比较🔥的闪卡SKILL
前端·github
miofly17 小时前
GitHub 日榜趋势速报 | 2026-09-26
开源·github