如何初始化一个线上的GitHub仓库,在本地已有的仓库中上传到线上

如何初始化一个线上的GitHub仓库,在本地已有的仓库中上传到线上,

首先,先创建一个线上的仓库

本地有一个曾经的仓库,或者本地git init创建一个本地仓库

根据线上仓库的主页给的提示代码进行上传

代码如下:

...or create a new repository on the command line

bash 复制代码
echo "# lyf0801.github.io" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:lyf0801/lyf0801.github.io.git
git push -u origin main

...or push an existing repository from the command line

bash 复制代码
git remote add origin git@github.com:lyf0801/lyf0801.github.io.git
git branch -M main
git push -u origin main
相关推荐
小弥儿1 小时前
GitHub今日热榜 | 2026-07-05:阿里巴巴浏览器Agent上榜
学习·开源·github
uhakadotcom2 小时前
什么是 “无界限的列表积累” 问题
后端·面试·github
AC赳赳老秦18 小时前
防火墙规则批量配置实战:OpenClaw 自动生成模板、批量下发与合规性校验全解析
java·开发语言·人工智能·python·github·php·openclaw
FPGA验证小袁1 天前
EMIF BFM设计与实现:把复杂时序装进“一键读写”的黑盒
github
汤姆yu1 天前
macOS系统下Aider完整安装、配置与实战使用教程
大数据·人工智能·算法·macos·github·copilot
小弥儿1 天前
GitHub今日热榜 | 2026-07-04
学习·开源·github
CoderJia程序员甲1 天前
GitHub 热榜项目 - 周榜(2026-07-04)
ai·大模型·llm·github
REDcker1 天前
GitHub SSH 连接失败排障实录
运维·ssh·github
菜鸟是大神1 天前
【Hermes入门11讲】第七讲:定时自动化——让Hermes成为你的24小时助手
人工智能·github·hermes
newbe365241 天前
我们如何使用 impeccable 优化前端界面设计与实现稳定性
前端·人工智能·分布式·github·aigc·wpf