[英]Git: How to Archive from remote repository directly?
我通常在我的project.git
中使用下面的命令来获取指定目的地的存档:
git archive master | tar -x -C /home/kave/site/
我想知道是否可以直接从远程存储库归档到目标目录?
我试过这样的事情,没有任何快乐:
git archive master https://kave@dndigital.git.cloudforge.com/myoproject.git | tar -x -C /home/kave/site/
有什么建议么? 谢谢
--remote=<repo>
Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.
命令应该像这样结束:
$ git archive --remote=https://kave@dndigital.git.cloudforge.com/myoproject.git master
但是,如果你只是提取 repo,你可以使用git clone
的--depth
参数进行浅克隆:
--depth <depth>
Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.
所以你有这样的事情:
$ git clone --depth=1 https://kave@dndigital.git.cloudforge.com/myoproject.git
另一个专门针对 GitHub 的选项是github-backup
。 它具有用于捕获特定于 GitHub 的功能(如问题、wiki 等)的选项。 这是我最近用来对其他人的存储库进行存档的示例命令行:
github-backup --all --pull-details --prefer-ssh --repository REPO REPO-OWNER -u mhucka
在上面的命令中, REPO-OWNER代表目标仓库的所有者, REPO是仓库名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.