如何初始化一个线上的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
相关推荐
spionbo1 小时前
苹果手机和安卓手机互传文件,LocalSend手机夸平台文件传输助手下载
github
无限进步_1 小时前
C语言atoi函数实现详解:从基础到优化
c语言·开发语言·c++·git·后端·github·visual studio
CoderJia程序员甲2 小时前
GitHub 热榜项目 - 日榜(2025-11-16)
ai·开源·大模型·github·ai教程
spionbo5 小时前
PDF 转 Word 有什么好用的电脑与手机的软件?你认为手机上最好用的PDF阅读器是哪一种?pdf转换APP推荐
github
MicrosoftReactor5 小时前
技术速递|GitHub Copilot 和 AI Agent 如何拯救传统系统
人工智能·github·copilot·agent
CozyOct113 小时前
⚡️2025-11-11GitHub日榜Top5|Go AI代理开发框架
github
草梅友仁16 小时前
代码重构与测试覆盖率提升实践 | 2025 年第 46 周草梅周报
单元测试·开源·github
粥里有勺糖20 小时前
视野修炼-技术周刊第127期 | Valdi
前端·javascript·github
无限进步_1 天前
【C语言】贪吃蛇游戏设计思路深度解析:从零开始理解每个模块
c语言·开发语言·c++·git·游戏·github·visual studio