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
相关推荐
怕浪猫6 分钟前
Prompt Engineering 面试怎么考?这 5 个范式你必须会
面试·程序员·github
可乐ea5 小时前
GitHub Security Lab 开源 Fuzzing Taskflow:让 LLM 智能体自己跑完 C/C++ 模糊测试
jvm·c++·github·模糊测试·mcp·代码agent·智能体自动化
TOOLS指南6 小时前
GitHub 和 ai.github 是什么?两者有什么区别
人工智能·github
贾斯汀frank6 小时前
Fleurdelix OS已预装办公套件ONLYOFFICE桌面编辑器
github
wflynn6 小时前
GitHub 日榜趋势速报 | 2026-09-30
开源·github
Cosolar12 小时前
云端部署阿里 Qwen-Image-2.1 保姆级教程
人工智能·后端·github
miofly13 小时前
GitHub 今日推荐|REDox:64 位 token 表示结构化数据,内存占用降 70% 支持多格式互转
开源·c#·github
奋进的LY13 小时前
spacy的安装和使用教程
人工智能·python·深度学习·github
guru13 小时前
手写一个 Tool-Calling Agent:为什么要先不用框架
github
miofly14 小时前
GitHub 日榜趋势速报 | 2026-10-03
开源·github