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
相关推荐
wtsolutions1 小时前
Real-World Use Cases - How Organizations Use Excel to JSON
json·github·excel
右手 无名指2 小时前
Github Actions工作流配置webhook推送到钉钉机器人
机器人·github·钉钉
CoderJia程序员甲3 小时前
GitHub 热榜项目 - 日榜(2026-01-18)
人工智能·ai·大模型·github·ai教程
PaQiuQiu20 小时前
GitHub 开源分享 | Coding Interview University
面试·开源·github
毛毛蹭蹭21 小时前
github copilot 0.33模型使用问题
github
介一安全21 小时前
国内 GitHub 仓库下载提速
gitee·github
CoderJia程序员甲1 天前
GitHub 热榜项目 - 日榜(2026-01-17)
ai·开源·大模型·github·ai教程
CryptoRzz1 天前
印度股票数据API对接实战(实时行情与IPO功能全解析)
websocket·区块链·github·共识算法·分布式账本
Aliex_git1 天前
GitHub Copilot 使用笔记
笔记·学习·github·copilot·ai编程
CoderJia程序员甲1 天前
GitHub 热榜项目 - 日榜(2026-1-12)
ai·开源·大模型·github·ai教程