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
相关推荐
老虎海子1 小时前
从零手搓一个 AI 编程助手:Mini Claude Code 完全指南
人工智能·git·vscode·python·github
lxllzwj52013143 小时前
Mac如何像shell一样丝滑的使用item2连接服务器.
服务器·macos·github
开发者每周简报3 小时前
十个奇异 github 项目
github
Arden Zhao4 小时前
Gihtub HTTP添加为HTTPS证书
https·github
HelloGitHub4 小时前
《HelloGitHub》第 122 期
开源·github
上海云盾-小余4 小时前
服务器入侵应急处置:入侵排查与溯源恢复全流程
运维·服务器·github
lpfasd1235 小时前
2026年第21周GitHub趋势周报
github
纪伊路上盛名在5 小时前
Github 命令行搜索工具
人工智能·数据分析·github
直接冲冲冲14 小时前
研0-准备claude
git·github
Yunzenn17 小时前
深度分析字节最新研究cola-DLM 第 07 章:推理流水线逐行拆解 —— 从 prompt 到生成文本
人工智能·驱动开发·深度学习·chatgpt·架构·prompt·github