如何初始化一个线上的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
相关推荐
@呱呱爱学习2 小时前
2026年09月28日 | 呱呱AI日报】GitHub 发布 Copilot WSL 教程,介绍在 Ubuntu 中运行编程 Agent
人工智能·github·copilot
阿里嘎多学长4 小时前
2026-09-28 GitHub 热点项目精选
开发语言·程序员·github·代码托管
程序员清风5 小时前
vLLM 实战:用 OpenAI 兼容接口部署本地大模型推理服务
开源·github·vllm
七牛云行业应用8 小时前
Jev 报 401 / api_key_required 怎么解决:TypeSafe AI 官方错误码表与排查步骤
算法·github
誰能久伴不乏9 小时前
保姆级 GitHub 协作教程
github
miofly14 小时前
Claude 自主发现类 CRISPR 结构的新型逆转录酶系统:Anthropic 生命科学实验室的早期成果
开源·github
HelloGitHub16 小时前
《HelloGitHub》第 126 期
开源·github
miofly17 小时前
GitHub 日榜趋势速报 | 2026-09-28
开源·github
miofly1 天前
GitHub 日榜趋势速报 | 2026-09-27
开源·github
怕浪猫1 天前
顶级模型一句话,AI 写出了能玩的 QQ飞车
前端·面试·github