如何初始化一个线上的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
相关推荐
吃饺子不吃馅9 分钟前
⚡️ Zustand 撤销重做利器:Zundo 实现原理深度解析
前端·javascript·github
whysqwhw37 分钟前
KMP类GSON转字符串工具
github
CoderJia程序员甲2 小时前
GitHub 热榜项目 - 日榜(2025-11-06)
ai·开源·大模型·github·ai教程
诸葛思颖4 小时前
把本地 Python 项目用 Git 进行版本控制并推送到 GitHub
git·python·github
chhanz15 小时前
git/github入门基操(终端版)
git·github
Bacon18 小时前
Electron 应用商店:开箱即用工具集成方案
前端·github
掘金安东尼1 天前
GPT-6 会带来科学革命?奥特曼最新设想:AI CEO、便宜医疗与全新计算机
前端·vue.js·github
逛逛GitHub1 天前
国产开源 AI CRM 系统,用它替换了 7 年的 Salesforce。
github
散峰而望1 天前
C++入门(二) (算法竞赛)
开发语言·c++·算法·github
HelloGitHub1 天前
让 AI 记住我家狗叫「十六」,原来只需要 5 分钟
开源·github