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
相关推荐
秋千易3 小时前
同一提交,旧基线红、新基线绿:基线放行了门禁
github
撸码猿9 小时前
1Password 后端被入侵:密码库为什么没被拿走
网络安全·github·供应链安全·钓鱼·1password
一条Go9 小时前
26 篇之后:Alioth 的 26 个设计决定
后端·github
一条Go9 小时前
开源新生代雷达 · 第 25 期
github
钱栈up13 小时前
GitHub热榜上手|Claude Code Game Studios:49个AI代理的独立游戏工作室
开源·github·shell
wflynn1 天前
GitHub 日榜趋势速报 | 2026-11-27
开源·github
一条Go1 天前
全链路 e2e:一次跑出 20 个现象,收敛成 5 个根因
后端·github·测试
一条Go1 天前
开源新生代雷达 · 第 24 期
github
钱栈up2 天前
GitHub 热榜上手|anthropics/skills:18.9万星的 Claude 技能库
python·开源·github
李永奉2 天前
Git和GitHub-VS Code 图形化 Git 放弃更改、暂存与取消暂存、撤销上一次提交(VS Code 界面操作 + 命令行对照)
git·github