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
相关推荐
~~李木子~~3 小时前
通过git上传项目到码云和GitHub操作手册
git·gitee·github
AI分享猿6 小时前
雷池 WAF 免费版实测:企业用 Apache 搭环境,护住跨境电商平台
web安全·github·apache
whysqwhw8 小时前
kotlin-4
github
whysqwhw8 小时前
kotlin-3
github
whysqwhw8 小时前
kotlin-1
github
whysqwhw8 小时前
kotlin-2
github
CoderJia程序员甲10 小时前
GitHub 热榜项目 - 日榜(2025-11-09)
github
labview_自动化10 小时前
GitHub笔记
笔记·github
知行力11 小时前
【GitHub每日速递 20251111】PyTorch:GPU加速、动态网络,深度学习平台的不二之选!
pytorch·深度学习·github
逛逛GitHub14 小时前
GitHub 开源 AI 好玩神器,自动记录你的一天。
前端·github