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
相关推荐
Mark108591 小时前
Hexo + GitHub Pages + GitHub Actions:源码私有、站点公开的 CI/CD 教程
ci/cd·github
徐小夕2 小时前
PDF无限制预览!Jit-Viewer V1.5.0开源文档预览神器正式发布
前端·vue.js·github
起个名字总是说已存在6 小时前
github开源AI技能:Awesome DESIGN.md让页面设计无限可能
人工智能·开源·github
zhensherlock7 小时前
Protocol Launcher 系列:Overcast 一键订阅播客
前端·javascript·typescript·node.js·自动化·github·js
第一程序员7 小时前
Python数据结构与算法:非科班转码者的学习指南
python·github
SUNNY_SHUN8 小时前
清华团队提出TFA-Net,用模板特征聚合破解工业异常检测中的“捷径学习“难题
人工智能·学习·视觉检测·github
CeshirenTester8 小时前
GitHub变了:私有仓库也要“喂AI”?开发者该怎么应对
人工智能·github
还好还好不是吗14 小时前
矩媒,一款 cli 和gui 共享状态的视频矩阵工具
github
darkb1rd14 小时前
RedSun:Defender 逻辑漏洞深度解析与指南
开源·github·好物分享