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
相关推荐
音元系统11 分钟前
Copilot 在 VS Code 中的免费替代方案
python·github·copilot
ai小鬼头4 小时前
AIStarter3.0.2全新发布:解锁用户、创作者、共创模式,轻松玩转AI项目
人工智能·程序员·github
寻月隐君6 小时前
用 Rust 实现 HTTPie:一个现代 CLI 工具的构建过程
后端·rust·github
徐小夕7 小时前
开源了一款基于Nextjs实现的精美CRM系统, 卷王程序员狂喜!
前端·react.js·github
Casia_Dominic9 小时前
【三维重建工具】NeRFStudio、3D GaussianSplatting、Colmap安装与使用指南
git·3d·github·点云
构建的乐趣9 小时前
运行ssh -T git@github.com报错
git·ssh·github
寻月隐君18 小时前
想用 Rust 开发游戏?这份超详细的入门教程请收好!
后端·rust·github
SoFlu软件机器人21 小时前
Cursor、飞算JavaAI、GitHub Copilot、Gemini CLI 等热门 AI 开发工具合集
人工智能·github·copilot
Albert_Lsk1 天前
【2025/07/11】GitHub 今日热门项目
人工智能·开源·github·开源协议
心.c1 天前
后台管理系统-权限管理
javascript·react.js·github