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
相关推荐
Code_流苏13 小时前
如何使用Git参与GitHub开源项目:入门全流程
git·开源·github·开源项目·入门学习
初级代码游戏15 小时前
基于C++的IOT网关和平台1:github项目ctGateway
c++·物联网·github
我是哪吒16 小时前
分布式微服务系统架构第124集:架构
后端·面试·github
掘金安东尼17 小时前
每天点开的 Omnissa Horizon Client,背后其实是一次完整的桌面重构
面试·github·远程工作
PPIO派欧云1 天前
PPIO X OWL:一键开启任务自动化的高效革命
运维·人工智能·自动化·github·api·教程·ppio派欧云
一纸忘忧1 天前
成立一周年!开源的本土化中文文档知识库
前端·javascript·github
吾日三省吾码1 天前
GitHub Copilot (Gen-AI) 很有用,但不是很好
人工智能·github·copilot
Gladiator5751 天前
博客记录-day154-面试
github