如何初始化一个线上的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
相关推荐
CoderJia程序员甲5 小时前
GitHub 热榜项目 - 日榜(2026-01-22)
ai·开源·大模型·github·ai教程
CoderJia程序员甲6 小时前
GitHub 热榜项目 - 日榜(2026-01-25)
开源·大模型·llm·github·ai教程
CoderJia程序员甲12 小时前
GitHub 热榜项目 - 日榜(2026-01-24)
git·ai·开源·llm·github
TTGGGFF16 小时前
告别繁琐命令行:自研多线程 SSH 极速文件传输助手(附 GitHub 源码)
运维·ssh·github
普通网友1 天前
远程配置 VsCode:Github Copilot 安装成功却无法使用?细节避坑
vscode·github·copilot
极智-9961 天前
GitHub 热榜项目-日榜精选(2026-01-24)| AI智能体工具、Python生态等 | remotion、VibeVoice、goose等
人工智能·python·github·ai智能体·大模型部署·语音ai
github.com/starRTC1 天前
Claude Code中英文系列教程17:将Claude Code集成在GitLab工作流里面
git·gitlab·github
JavaPub-rodert2 天前
通过 GitHub 仓库下载微信 Mac & Windows 历史版本(Rodert 提供)
macos·微信·github
旅之灵夫2 天前
【GitHub项目推荐--OpenEmu:macOS 复古游戏模拟器】
3d·github·策略模式
散峰而望2 天前
【数据结构】假如数据排排坐:顺序表的秩序世界
java·c语言·开发语言·数据结构·c++·算法·github