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
相关推荐
Jiude5 小时前
AI 写代码太快之后,团队协作反而更难了
人工智能·架构·github
2401_876964139 小时前
27考研余炳森概率论|喻老李良2027资料网课
windows·git·考研·svn·eclipse·github·概率论
AhriProGramming9 小时前
GitHub开源项目推荐-1:pyd_packer
github
独自归家的兔10 小时前
AI界的 GitHub?Hugging Face 全面解析
人工智能·github
逛逛GitHub12 小时前
GitHub 上刚开源的国产 3D 高斯浏览器,杭州六小龙给力啊。
github
code_li14 小时前
免费服务器指南:GitHub Pages搭建静态网站全攻略
github·部署·免费服务器
阿里嘎多学长15 小时前
2026-05-28 GitHub 热点项目精选
开发语言·程序员·github·代码托管
小小程序员mono17 小时前
模型进入「日更时代」:GPT-5.6 泄露、Claude 4.8 逼近、Gemini 3.5 上线、国产杀疯了摘要
人工智能·重构·开源·github
Larcher17 小时前
「Codex + DeepSeek 用户请进:你的对话记录是不是也卡到想砸键盘?」
人工智能·github·编程语言
程序员柒叔18 小时前
Dify 一周动态-2026-W22
人工智能·大模型·github·agent·知识库·dify