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
相关推荐
TunerT_TQ2 小时前
GitHub每日热评|用写HTML的方式生成确定性MP4:HeyGen开源的HyperFrames到底强在哪?
开源·github·资讯
楠楠子呀2 小时前
给 GitHub Pages 这类纯静态站加 WhatsApp 入口:三种不引后端的写法
github
lindd9119113 小时前
github项目Readme文档制作与远程推送(全自动化上传)
ai·github·ai的skill使用
毕竟是shy哥3 小时前
远程服务器使用github代理
github
EAIReport4 小时前
GitHub 超全使用指南|托管、协作、开源实战教程
开源·github
乱码三千4 小时前
密码管理工具站正式上线啦
前端·html·github
峰向AI4 小时前
261 种手绘风格:双语提示词,这个 skill 夯爆了!
github
passerby606113 小时前
如何自己造一个时间处理库
前端·javascript·github
小弥儿18 小时前
GitHub今日热榜 | 2026-09-04:Agent省 token 成今日主线
学习·开源·github
苏灿烤鱼20 小时前
给 AI Agent 装一个「会进化的大脑」:OpenViking 深度拆解
开源·github·agent