如何初始化一个线上的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
相关推荐
禁默1 小时前
基于Rust实现爬取 GitHub Trending 热门仓库
开发语言·rust·github
Lab4AI大模型实验室2 小时前
【Github热门项目】DeepSeek-OCR项目上线即突破7k+星!突破10倍无损压缩,重新定义文本-视觉信息处理
人工智能·github·deepseek-ocr
ruanCat3 小时前
对 changelogen 和 changelogithub 使用的思考
前端·github
散峰而望13 小时前
C/C++输入输出初级(一) (算法竞赛)
c语言·开发语言·c++·算法·github
C.咖.15 小时前
Linux环境下——Git 与 GitHub
linux·git·github·远程仓库
CoderJia程序员甲17 小时前
GitHub 热榜项目 - 日榜(2025-11-12)
ai·开源·大模型·github·ai教程
mortimer20 小时前
只需三步,动手搭建一个本地免费【实时语音转录】工具WhisperLiveKit
ffmpeg·github·openai
卡洛斯(编程版1 天前
拉取github更新到本地
github
逛逛GitHub1 天前
副业搞个 100 万,这 5 个 GitHub 项目不能错过。
github
CoderJia程序员甲1 天前
GitHub 热榜项目 - 日榜(2025-11-10)
ai·开源·llm·github