如何初始化一个线上的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
相关推荐
Codeking__2 小时前
Redis——基本通用命令
redis·git·github
独自破碎E2 小时前
下载 GitHub 仓库「单个文件夹」的方法
github
大厂技术总监下海3 小时前
“Today I Learned”(TIL):一种比写博客更可持续的知识沉淀习惯
大数据·开源·github
掘金安东尼8 小时前
⏰前端周刊第 448 期(2026年1月4日-1月10日)
前端·面试·github
掘金安东尼9 小时前
向大家介绍《开发者博主联盟》🚀
前端·程序员·github
梅羽落10 小时前
fastapi速成2
python·github·fastapi
程序员Agions10 小时前
你的.env 文件,可能正在 GitHub 上裸奔
github
CoderJia程序员甲12 小时前
GitHub 热榜项目 - 日榜(2026-1-15)
开源·大模型·llm·github·ai教程
一颗青果13 小时前
TCP全连接队列与抓包
网络·tcp/ip·github
想用offer打牌14 小时前
非常好用的工具: curl
java·后端·github