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
相关推荐
wflynn30 分钟前
GitHub 日榜趋势速报 | 2026-10-29
开源·github
伊布拉西莫38 分钟前
GitHub Actions 自动化发布指南
github·devops
是jin奥2 小时前
Claude Code + GitHub 自动化工作流整理
运维·自动化·github
qianx773 小时前
KiteNote: 结合MicrosoftToDo和Obsidian优势的日常笔记软件
github
用户466969256973 小时前
AI编码账单砍60%:这个84K星的小工具,一行命令装好
github
简创AIGC陶先生3 小时前
【直播切片工作台】第22章:素材下载与 URL 重写
github
KevinAshen673 小时前
用 Go 修复旧下载工具:从接口 403 到凭证截断的完整复盘
go·github
miofly3 小时前
GitHub 今日推荐|Edge0:让大号 MoE 模型在一台 Mac 上流式跑起来
python·开源·github
shandianchengzi4 小时前
【记录】LLM|ChatGPT连接Github并管理
chatgpt·github
徐小夕5 小时前
JitOffice:把办公、AI 与审批装进同一个平台
前端·vue.js·github