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
相关推荐
葬送的代码人生11 分钟前
别再「Ctrl+C/V」了!Git 开发必备技能,10 分钟告别单机码农
前端·github·代码规范
码农翻身20 分钟前
GitHub,2008年生,2048年卒
github
文滨42 分钟前
10分钟搞定!Mac 配置 GitHub SSH 完全指南(小白也能看懂)
前端·macos·ssh·github
MicrosoftReactor1 小时前
技术速递|六个编码智能体,一个生产级系统:基于 AKS-Lab-GitHubCopilot 的 AgenticOps 实战指南
ai·github·copilot·智能体
weelinking1 小时前
【claude】15_Claude使用经验与最佳实践
前端·人工智能·python·sql·数据挖掘·前端框架·github
DogDaoDao1 小时前
【GitHub】AgentMemory 深度解析:让 AI 编程代理拥有持久化记忆的 16K+ Star 开源方案
人工智能·开源·大模型·github·aigc·ai编程·aiagent
热点速递1 小时前
老程序员怒斥GitHub不行了!1.5亿人用的代码仓库要完?
github·业界资讯
STDD17 小时前
Soulmask《灵魂面具》 专用服务器搭建教程
运维·服务器·github
lolo大魔王17 小时前
Linux的监测程序
linux·运维·github
米高梅狮子21 小时前
Redis
数据库·redis·mysql·缓存·docker·容器·github