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
相关推荐
qianmoQ1 小时前
GitHub 趋势日报 (2025年05月21日)
github
冰茶_1 小时前
VSCode推出开源Github Copilot:AI编程新纪元
vscode·开源·github·copilot·ai编程
qianmoQ2 小时前
GitHub 趋势日报 (2025年05月20日)
github
码农捻旧13 小时前
Node.js Express 项目现代化打包部署全指南
javascript·node.js·github·express
王了了哇15 小时前
【关联git本地仓库,上传项目到github】
git·github
Sgq丶15 小时前
Git 提交大文件 this exceeds GitHub‘s file size limit of 100.00 MB
git·github
中国lanwp18 小时前
使用Maven部署应用到TongWeb(东方通应用服务器)
git·github·maven
兔子坨坨20 小时前
IDEA连接github(上传项目)
java·git·学习·github
快解析1 天前
代码管理平台Gitlab如何通过快解析实现远程访问?
gitlab·github
蔗理苦1 天前
Typora + PicGo + GitHub 配置图床——图片自动上传 详细教程
github·typora·picgo