如何初始化一个线上的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
相关推荐
Sahadev_9 小时前
GitHub 一周热门项目速览 | 2025年12月22日
github
happygrilclh16 小时前
SVN转移服务器仓库后,旧服务器不能被访问的解决办法
github
starsky_walker17 小时前
【工具教程系列】--如何配置github的ssh
运维·ssh·github
逛逛GitHub17 小时前
最近爆火的人生K线!GitHub 上有开源,真的太有趣了。
github
怣疯knight19 小时前
windows比较好用的翻译软件
开源·github
Bigger19 小时前
npm Classic Token 作废后,CI/CD 自动发包如何改?一份完整踩坑复盘
ci/cd·npm·github
YMGogre20 小时前
GitHub 仓库管理员
git·github
古城小栈20 小时前
GitHub Copilot for Java:上下文感知重构建议实操
java·github·copilot
CoderJia程序员甲20 小时前
GitHub 热榜项目 - 日榜(2025-12-23)
ai·开源·大模型·github·ai教程
于谦21 小时前
✨ feat(app1,pkg1): monorepo生成规范化提交信息的最优解 - committier
javascript·github·代码规范