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
相关推荐
cg50171 小时前
Continue插件实现本地部署一个“cursor”或“github copilot”
github·copilot·curcor
妙娲种子2 小时前
gittee连接github镜像
gitee·github
无限进步_2 小时前
C语言实现贪吃蛇游戏完整教程【最终版】
c语言·开发语言·c++·git·游戏·github·visual studio
CoderJia程序员甲3 小时前
GitHub 热榜项目 - 日榜(2026-01-21)
ai·开源·大模型·github·ai教程
亮子AI3 小时前
【Github】如何取消 issue 自动加入 project 的功能?
github·issue
徐小夕@趣谈前端4 小时前
【推荐】jitword协同文档新增AI公文助手,一键生成红头文件
vue.js·人工智能·开源·编辑器·github
Allen_LVyingbo4 小时前
用Python实现辅助病案首页主诊断编码:从数据清洗到模型上线(上)
开发语言·python·github·知识图谱·健康医疗
海雅信子4 小时前
上传本地文件到github
github
Cliven_4 小时前
Github自动打包推送Maven中央仓库
java·github·maven
DarrenPig13 小时前
【常州工NEC】ROBOCON小白入门之路(二)2026CURC-NEC赛季规划
开源·github·交流·robocon