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
相关推荐
YuePeng9 小时前
我用 30 行 Java 注解,做出了别人花三周写的管理后台,还顺手接入了 DeepSeek
后端·github
无心水12 小时前
【Hermes:MCP 与工具实战】28、GitHub MCP 深度实战:PR 审查、Issue、自动汇报全搞定
人工智能·github·issue·openclaw·养龙虾·hermes·honcho
逛逛GitHub12 小时前
GitHub 上狂揽 1.8 万 Star!开源平替的 Claude Design。
github
shisanjin12313 小时前
关于 IDEA2025 版本中对 git 的操作与使用
git·github·idea
希望未来不会秃13 小时前
【Git实战】如何将本地已有项目关联并推送到指定的远程仓库(保姆级教程)
git·gitee·github
- J°雾13 小时前
GitNexus 安装配置 + 网页版 GUI 使用教程(Windows 环境)
windows·开源·github·知识图谱
小橙讲编程13 小时前
40+kStar 的多智能体编排引擎 Ruflo 深度技术解析:Claude Code 如何从单兵作战进化为 AI 蜂群指挥系统
开源·github
bu_shuo15 小时前
hexo 上传到github命令报错
github
阿里嘎多学长15 小时前
2026-05-04 GitHub 热点项目精选
开发语言·程序员·github·代码托管
WindrunnerMax16 小时前
基于 Markdown-It 的无序列表折叠插件
前端·javascript·github