我试过:
git archive HEAD --format=zip > archive.zip
:然后我通过电子邮件发送 archive.zip,在另一端他们将 archive.zip 解压缩到一个文件夹中。但是当他们尝试任何 git 命令时,他们发现这不会生成有效的 git 存储库
最佳答案
你可以使用 git bundle
并通过电子邮件发送一个文件
参见“backing up project which uses git”
A git bundle is just one file which can be very easily created and again imported as it can be treated like another remote.
收到后,您可以克隆它或从该文件中获取。
如“Backup of github repo”中所述,您可能希望第一封电子邮件与所有 分支捆绑在一起:
$ git bundle create /tmp/foo-all --all
作为Andreas在评论中提到, Scott Chacon 最近(2010 年 3 月)在 ProGit blog 上写了一篇关于这个主题的“可爱”文章:
关于git - 我如何通过电子邮件向某人发送 git 存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2545765/