Git: How to Archive from remote repository directly?

后端 未结 2 1739
灰色年华
灰色年华 2020-12-09 08:22

I usually use the command below inside my project.git to get an archive in the specified destinations:

git archive master | tar -x -C /home/kave         


        
相关标签:
2条回答
  • 2020-12-09 08:49

    Another option, specifically for GitHub, is github-backup. It has options to capture GitHub-specific features like issues, wikis, and so on. Here is an example command-line I used recently to make archives of some other people's repositories:

    github-backup --all --pull-details --prefer-ssh --repository REPO REPO-OWNER -u mhucka
    

    In the command above, REPO-OWNER stands for the owner of the target repository and REPO is the repository name.

    0 讨论(0)
  • 2020-12-09 09:02

    From git help archive:

       --remote=<repo>
           Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.
    

    Command should end up like:

    $ git archive --remote=https://kave@dndigital.git.cloudforge.com/myoproject.git master
    

    But, if you would just extract the repo, you can make a shallow clone using --depth parameter of git clone:

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

    So you have something like this:

    $ git clone --depth=1 https://kave@dndigital.git.cloudforge.com/myoproject.git
    
    0 讨论(0)
提交回复
热议问题