如何初始化一个线上的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
相关推荐
我命由我123452 小时前
Git 推送报错:error: src refspec main does not match any
运维·git·gitee·github·运维开发·学习方法·版本控制
阿里嘎多学长3 小时前
2026-09-20 GitHub 热点项目精选
开发语言·程序员·github·代码托管
峰向AI4 小时前
skill-up: [阿里开源] 让 AI Agent Skills 自己进化的评估工具
github
子林super7 小时前
顺序表用Python3定义与增删改查
github
子林super7 小时前
Python非空判断与类型检查写法
github
子林super7 小时前
Python list与array关键区别及使用场景
github
子林super7 小时前
Python中None与null的区别
github
u1301309 小时前
GitHub 热榜项目:周榜(2026-09-20)
人工智能·github
u13013011 小时前
GitHub 热榜项目:日榜(2026-09-20)
人工智能·github
逛逛GitHub11 小时前
外网 3500 万人围观的 Jev 模型,有这 10 个神奇玩法。
github