迁移本地git到远程
1.迁移本地git到远程
2.git 回滚版本迁移本地git到远程,
可以保留提交记录,
但是没有分支,这个可以自己下载分支code,再提交所有分支到new git。 //或者保留 所有diff 或者commit 文件
参考
https://blog.csdn.net/github_38336924/article/details/118544619
第一步,从远程仓库克隆到本地//先下载source 仓库到本地 git clone https://github.com/oldxxx/oldxxx.git 第二步,删除需要迁移的本地项目所关联的远程仓库地址 (在本地source仓库,输入以下命令删除关联) git remote remove origin 第三步,关联新仓库的地址 git remote add origin https://github.com/newxxx/newxxx.git 第四步,把项目推送到新的远程仓库 //其实这步, 已经把old git提交记录, 迁移到new git了 git push 第五步,从原仓库地址克隆一份裸版本库 git clone --bare https://github.com/oldxxx/oldxxx.git 第六步,原仓库所有分支同步新仓库 git push --mirror https://github.com/newxxx/newxxx.git
example: //old repo =>local git folder d/pro/MyGitRepo/oldxxx //new repo =>remote https://git.com/xxx2022/newxxx.git 是私有的 ============================================ 操作实例: $cd /d/pro/MyGitRepo/oldxxx $ git clone [old git repo] test@DESKTOP-8953GMH MINGW64 /d/pro/MyGitRepo/oldxxx (master) $ git remote remove origin test@DESKTOP MINGW64 /d/pro/MyGitRepo/xxx (master) $ git remote add origin https://gitee.com/xxx2022/newxxx.git test@DESKTOP MINGW64 /d/pro/MyGitRepo/xxx (master) $ git push fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master test@DESKTOP MINGW64 /d/pro/MyGitRepo/xxx (master) $ git push --set-upstream origin master remote: [session-1946ecb0] ?????@??.com: Incorrect username or password (access token) fatal: Authentication failed for 'https://github.com/xxx2022/newxxx.git' test@DESKTOP MINGW64 /d/pro/MyGitRepo/xxx (master) $ git push --set-upstream origin master Enumerating objects: 413, done. Counting objects: 100% (413/413), done. Delta compression using up to 20 threads Compressing objects: 100% (223/223), done. Writing objects: 100% (413/413), 1.06 MiB | 642.00 KiB/s, done. Total 413 (delta 229), reused 339 (delta 178), pack-reused 0 remote: Resolving deltas: 100% (229/229), done. remote: Powered by github.COM [GNK-6.4] To https://github.com/xxx2022/newxxx.git * [new branch] master -> master Branch 'master' set up to track remote branch 'master' from 'origin'. test@DESKTOP MINGW64 /d/pro/MyGitRepo/xxx (master) $
合集:
git+项目管理
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
2018-11-04 Jlink flash 烧录HEX 程序
2015-11-04 process thread Fiber(linux)