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
相关推荐
fthux2 小时前
“装闭”,让装修套路“装”不下去
人工智能·ai·开源·github·open source
用户84913717547165 小时前
想做护眼工具却脑子一片空白?我用 OpenSpec 把模糊想法聊成了 v0.1
github·vibecoding
wangruofeng6 小时前
git-filter-repo 把 .git 从 112MB 砍到 1.4MB,但漏推 tag 让 clone 又胖回来
github·devops
峰向AI7 小时前
Block 放出大招!Buzz:一个中继统一代码、聊天、CI 全流程
github
dong_junshuai7 小时前
每天一个开源项目#47 4.4K Stars 的 LikeC4:让架构图随代码进化
github
独立开阀者_FwtCoder10 小时前
最近做了一个健身小程序:智形健身助手,健身的佬们来提点意见
前端·javascript·github
夕夕木各13 小时前
从第一个 PR 到 Vite 官方中文文档维护者
github·vite
隔窗听雨眠15 小时前
GitHub Actions自动化运维实战:从零构建一体化CI/CD流水线
运维·自动化·github
dong_junshuai1 天前
每天一个开源项目#46 World Monitor:6.6万星、56层地图的全球情报中枢
github
Xu_youyaxianshen2 天前
Git 零基础常用指令手册(Gitee / GitHub 通用 )
git·gitee·github