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
相关推荐
归故里1 小时前
harmony-next.skills 为 AI 而生!
前端·后端·github
右耳朵猫AI2 小时前
Github趋势榜 2026年第15周
github
米高梅狮子2 小时前
01.mysql的备份与恢复
运维·数据库·mysql·docker·容器·kubernetes·github
本地化文档2 小时前
rust-style-guide-l10n
rust·github·gitcode
Revio Lab2 小时前
如何在国内API方式接入 Claude Opus 4.7、GPT-5.5、GPT Image 2
gpt·github
猫猫与橙子3 小时前
ubuntu22.04(google浏览器)使用开发者边车(DEV-SIDECAR)的使用
github
ChampaignWolf3 小时前
Tabnine vs GitHub Copilot 2026: 隐私、定价、380 次补全实测
github·copilot
wAIxiSeu5 小时前
开源项目分享——Cube
开源·github
冴羽yayujs5 小时前
快速夯实 JavaScrilpt 基础的 33 个概念
前端·javascript·github·前端开发
日取其半万世不竭5 小时前
auditd:Linux 系统审计日志,记录谁动了你的服务器
linux·服务器·github