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

相关推荐
redreamSo3 分钟前
一个只有70行的文件,凭什么拿下GitHub 10万星?
人工智能·开源
鹏子训1 小时前
Free-Programming-Books 开源资源库快速上手指南
开源
weixin_514253182 小时前
430-aguvis tmux
github
带娃的IT创业者2 小时前
LocalSend:重新定义跨平台文件传输的开源利器
开源·跨平台·文件传输·airdrop·localsend
JAVA面经实录9172 小时前
Java开发工程基础完整手册(企业实战完整版)
java·开发语言·git·ci/cd·svn·github·intellij idea
zh_xuan3 小时前
github远程library仓库升级
android·github
本地化文档3 小时前
rust-nomicon-l10n
rust·github·gitcode
Maynor9963 小时前
Codex 中国站正式上线!
人工智能·gpt·macos·github
本地化文档3 小时前
setuptools-docs-l10n
python·github·gitcode
学页3 小时前
假期无人值守背后的技术支撑:定时任务、消息队列与状态机
开源