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
相关推荐
newbe365241 小时前
我们如何使用 impeccable 优化前端界面设计与实现稳定性
前端·人工智能·分布式·github·aigc·wpf
一次旅行7 小时前
AI 前沿日报 | 2026年7月3日 星期五
人工智能·github·ai编程
青山木11 小时前
快速搭建免费的个人博客网站:Hexo + GitHub Pages + Butterfly 完整指南
git·github
阿里嘎多学长15 小时前
2026-07-03 GitHub 热点项目精选
开发语言·程序员·github·代码托管
owCode19 小时前
Windows RX6500XT(gfx1034) Ollama AMD ROCm 完整安装教程
语言模型·chatgpt·github·llama·gpu算力
江畔柳前堤1 天前
第14章:Docker 与 CI/CD
运维·ci/cd·docker·容器·eureka·github
wangruofeng2 天前
7.1 万 Star 的 MinerU,把 PDF 变成 LLM 能读懂的 Markdown
github
wangruofeng2 天前
75k Star 的 OCR 传奇——Tesseract 的 40 年,从 HP 实验室到 LSTM 神经网络
github
逛逛GitHub2 天前
又挖到 3 个不错的 GitHub 项目,尤其是第 2 个。
github
逛逛GitHub2 天前
GitHub 上 13 万星的爬虫神器,不要 API Key 就能用了。
github