如何初始化一个线上的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
相关推荐
凌晨一点的秃头猪10 小时前
【无标题】
github
weelinking11 小时前
【企业级】企业级大模型合规实战:数据安全与跨境传输的技术解决方案
数据库·人工智能·机器学习·云计算·github
韭菜钟11 小时前
Windows下,在Github Copilot Chat/CLI中使用obra/superpowers
windows·github·copilot
Larcher15 小时前
# 告别“古法编程”:吴恩达 AI 课程学习笔记与生日贺卡项目实战
前端·github·ai编程
irpywp16 小时前
Rilmazafone :一款可视化 DMG 编辑器,拖拽排版一键生成
开源·编辑器·github
csdn小瓯21 小时前
CI/CD流水线搭建:GitHub Actions + Docker + Railway自动化部署实战
ci/cd·docker·github
不做无法实现的梦~21 小时前
Git 新手到团队协作与 GitHub/GitCode 指南
git·github·gitcode
亦暖筑序21 小时前
Vibe Coding 用久了,代码手感真的会退化——以及我怎么试图解决这个问题
程序员·开源·github
谷哥的小弟21 小时前
(最新版)Git&GitHub实操图文详解教程(02)—安装Git
git·github·安装·配置·下载·图文教程