开发者

Git Archive of local Git repository

I have a Git repository on a server and on the same server I have开发者_如何学运维 a script which needs to do a git archive of the repository.

Here's my sample git archive command which works well for remote Git repositories:

sudo git archive --remote=ssh://uname@dev.example.com/var/repo/myrepo.git --format=tar --output=src.tar development

What would I need to do/change to execute the aforementioned command on the same server so that I don't need to put all the SSH stuff? Since the command is running on the same machine as the repository, can I get away with directly accessing the Git directory.

Thanks


Use

cd .../yourcode
sudo git archive --format=tar --output=src.tar development

(it is probably unnecessary to sudo)


Sure. Just run git archive from the directory that contains the local repo, and don't specify --remote.


From the directory that is your git repository run: git archive | bzip2 > full/relative/or/qualified/path/to/place/you/want/to/store/your/archive.tar.bz2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜