怎样打包git repo,才能不丢失.git,不丢失任何文件,保留所有文件和git元数据?

一开始尝试使用 zip -r 打包,发现会丢失一些文件
接着使用 git archive --format zip --output /full/path/to/zipfile.zip master 打包 git repo,发现这种方法不会把.git打包进去
然后自己找到了一个可以用的方法

1. 使用 tar -czf 打包git仓库
git clone /opt/helloworld/ folder2 tar -czf helloworld-latest.zip folder2
2. 使用 tar xvf 解包 (如果使用 unzip 解包会报错)



 

posted @ 2023-01-04 17:25  yinhuachen  阅读(86)  评论(0编辑  收藏  举报