github 一个仓库所有分支迁移(拷贝)到新的仓库

# 克隆旧仓库
git clone --mirror https://github.com/username/old-repo.git
cd old-repo.git(cd到旧仓库镜像目录)

# 设置新仓库为远程仓库
git remote set-url origin https://github.com/username/new-repo.git

# 推送所有分支和标签到新仓库
git push --mirror
 
# 清理本地镜像(可选,或者直接删除文件夹)
cd ..
rm -rf old-repo.git
posted @ 2024-12-12 18:46  独寒江雪  阅读(142)  评论(0)    收藏  举报