5. 如何把开源仓库同步到自己的gitee/github/gitlab,同时保留git log(代码提交记录)

文章目录

场景

在网上看到想学习的代码仓库A,想同步到自己使用顺手的托管平台(gitee / gitlab / github),我该怎么操作?(前提:需要同步仓库A的所有git log)

步骤
  1. download / git clone 仓库A
  2. 在托管平台(gitee / gitlab / github)新建自己的仓库B
  3. 在仓库A的根目录下打开 git bash窗口
bash 复制代码
# 查看仓库A当前关联的"远程仓库地址"
git remote -v

# 删除现有的"远程仓库地址"
git remote remove origin

# 更新"远程仓库地址"为仓库B的地址(eg. https://gitee.com/xxx/xxx.git)
git remote add origin 仓库B地址

# 推送所有代码和log到仓库B
git pull origin master --allow-unrelated-histories
git push -u origin master
  1. 进入 仓库B 的WebUI页面查看是否成功。
参考链接

https://blog.csdn.net/linzhish/article/details/126986212

https://www.cnblogs.com/Nyan-Workflow-FC/p/14454788.html

相关推荐
shandianchengzi8 小时前
【记录】Copilot|Github Copilot重新学生认证通过方法(2025年7月,包括2FA和认证材料、Why are you not on campus)
github·copilot
K1ne_8 小时前
2026 最新版|学生认证白嫖 GitHub Copilot Pro 保姆级教程
github·copilot
cs.shunzhang8 小时前
GitHub 教育认证通过后如何领取 Copilot Pro
github·copilot
程序员柒叔8 小时前
OpenCode 踩坑记:GitHub Copilot 按次计费?我的账单为何暴涨 3 倍!
github·copilot·claude code·opencode
刚刚觉醒的小菜鸡8 小时前
copilot学生认证2026-github copilot学生认证(手把手教会)
github·copilot
徐小夕9 小时前
我花一天时间Vibe Coding的开源AI工具,一键检测你的电脑能跑哪些AI大模型
前端·javascript·github
冬奇Lab10 小时前
一天一个开源项目(第74篇):OpenCLI - 把任意网站变成零成本 CLI 工具的 AI Agent 基础设施
人工智能·开源·资讯
沐曦股份MetaX14 小时前
沐曦股份曦云C系列GPU Day 0适配MiniMax M2.7 澎湃算力支持“自进化”大模型
人工智能·开源
qwfy15 小时前
我从瑞幸咖啡小程序里,拆出了一套 22 个组件的开源 UI 库
微信小程序·开源
一乐小哥15 小时前
如何写一个好的 Pull Request
github