git仓库迁移和更新远程仓库地址
git仓库迁移和更新远程仓库地址
一、git仓库迁移
1,从原仓库clone或pull到本地仓库
git clone project_name 【old_remote_repository_address】
2,在新的git创建一个新仓库。如果用gitolite搭建的git服务器,那么只需要在配置文件gitolite.conf上添加仓库和用户,然后push到服务器即可。
3,进入clone下来的本地仓库目录,将远程仓库地址修改为新的远程仓库地址
project_name> git remote remove origin
project_name> git remote add origin【new_remote_repository_address】
4,将本地仓库文件push到新的远程仓库
project_name> gitpush origin master
二、修改远程仓库地址
两种方式,除了上面第3步的修改方法,还可以:
git remote set-url origin 【new_remote_repository_address】
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】Flutter适配HarmonyOS 5知识地图,实战解析+高频避坑指南
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步