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窗口
# 查看仓库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

最近更新

  1. TCP协议是安全的吗?

    2024-02-04 10:38:01       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-02-04 10:38:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-02-04 10:38:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-02-04 10:38:01       18 阅读

热门阅读

  1. Vue3入门到实战笔记02

    2024-02-04 10:38:01       29 阅读
  2. 如何在一台机器上管理多个 GitHub 账户

    2024-02-04 10:38:01       38 阅读
  3. 了解Web框架

    2024-02-04 10:38:01       33 阅读
  4. Elasticsearch的使用场景深入详解

    2024-02-04 10:38:01       38 阅读
  5. 五大架构风格之五:仓库架构风格

    2024-02-04 10:38:01       31 阅读