首页 > 技术文章 > git push --mirror $URL

ccielife 2020-04-14 14:57 原文

背景:因为成本的问题,公司决定从github迁移将近250个仓库到codecommit。

我和同事合作进行了github仓库迁移到codecommit,迁移完成之后把在github的仓库进行了删除。

我负责的部分是,将github仓库备份到1台ec2,迁移完成之后删除仓库。

运维同事F负责将ec2上的github仓库,推送到codecommit,赋权给对应的成员。

备份脚本:

[root@localhost git]# cat clone_repo.sh
#!/bin/bash
cat /git/all_repo.txt|while read line
do
cd /git/remove_repo_last_bak/ &&git clone --mirror $line
done

 

开发同事Z,要xx仓库的代码,但在codecommit没有找到,结论是运维同事F没有将这个仓库推动到codecommit。

所以,我这边去找到这个仓库的备份,但是cd到目录,没有代码

 

 

加上这个仓库已经删除。

于是决定先还原到github,然后再查看。

git push --mirror $URL

 

推送到github之后,果然有,接着下载了ZIP包给了开发同事Z。

 

推荐阅读