如何初始化一个线上的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 [email protected]:lyf0801/lyf0801.github.io.git
git push -u origin main

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

bash 复制代码
git remote add origin [email protected]:lyf0801/lyf0801.github.io.git
git branch -M main
git push -u origin main
相关推荐
云攀登者-望正茂7 小时前
Jenkins 多分支流水线: 如何创建用于 Jenkins 状态检查的 GitHub 应用
云原生·github·jenkins
qianmoQ7 小时前
GitHub 趋势日报 (2025年04月20日)
github
西瓜本瓜@11 小时前
在 Android 中实现通话录音
android·java·开发语言·学习·github·android-studio
码流怪侠11 小时前
🚀 2025年 GitHub 暴涨 star 热门项目 🔥【持续更新】
程序员·github
Gladiator57514 小时前
博客记录-day148-力扣+面试
github
创实信息15 小时前
GitHub Copilot在产品/安全团队中的应用实践:处理Markdown、自动化报告与电子表格、使用CLI命令等
github·copilot·ai编程
七月丶16 小时前
📦 把 CLI 工具发布到 npm:gix 发布流程全解析(附 CI 自动化)
前端·后端·github
流沙krysent19 小时前
git常用指令
前端·github
运营猫小海豚19 小时前
Dootask任务管理实战——从需求到交付的闭环
前端·github
我是哪吒20 小时前
分布式微服务系统架构第118集:Future池管理容器-CompletableFuture
后端·面试·github