簡體   English   中英

Git:如何直接從遠程存儲庫歸檔?

[英]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/

有什么建議么? 謝謝

git help archive

   --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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM