Подтвердить что ты не робот

Git: Как архивировать из удаленного репозитория напрямую?

Обычно я использую следующую команду внутри project.git, чтобы получить архив в указанных целях:

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

Интересно, может ли его возможность архивировать непосредственно из удаленного репозитория в целевой каталог?

Я пробовал что-то вроде этого, без всякой радости:

git archive master https://[email protected]/myoproject.git | tar -x -C /home/kave/site/

Любые предложения? Благодаря

4b9b3361

Ответ 1

От 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://[email protected]/myoproject.git master

Но если вы просто извлечете репо, вы можете сделать мелкий клон, используя параметр --depth 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.

Итак, у вас есть что-то вроде этого:

$ git clone --depth=1 https://[email protected]/myoproject.git