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
相关推荐
万少3 小时前
我是如何感觉到被时代抛弃的
github
汪海游龙6 小时前
告别 Play Console 手动上传:从模拟器截图到自动发版的完整流水线
android·ci/cd·github
沫璃染墨7 小时前
《从零入门Linux系统篇(十四):系统工具篇·五——Git版本控制:从版本管理到协同开发》
linux·运维·服务器·git·gitee·github
fthux8 小时前
装闭 RenoPit 源码解析(02):AI装修闭坑系统数据库与模型设计
人工智能·ai·开源·github·open source·renopit
本地化文档11 小时前
skbuild-docs-l10n
python·github·gitcode·sphinx
XS03010612 小时前
GitHub/Gitee 团队协作笔记
笔记·gitee·github
csdn_aspnet13 小时前
在 Visual Studio Code 中安装使用 Github Copilot
ide·vscode·github·copilot
CoderJia程序员甲14 小时前
GitHub 热榜项目 - 周榜(2026-08-08)
ai·大模型·github·agent
阿米亚波1 天前
【C/C++包管理器】vcpkg(by microsoft)
c语言·c++·git·vscode·microsoft·github·vcpkg
打工的小王1 天前
github教程之多人协作
github