Git:como obter directamente do repositório remoto?
normalmente uso o comando abaixo dentro do meu project.git
para obter um arquivo nos destinos especificados:
git archive master | tar -x -C /home/kave/site/
pergunto-me se será possível arquivar directamente de um repositório remoto em vez disso num directório de destino?
Tentei algo assim, sem qualquer alegria.git archive master https://[email protected]/myoproject.git | tar -x -C /home/kave/site/
Alguma sugestão? Obrigado.
22
1 answers
De git help archive
:
--remote=<repo>
Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.
O comando deve acabar como:
$ git archive --remote=https://[email protected]/myoproject.git master
Mas, se você extrair o repo, você pode fazer um clone raso usando --depth
parâmetro degit 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.
Então tens algo assim:
$ git clone --depth=1 https://[email protected]/myoproject.git
29
Author: mgarciaisaia, 2016-05-26 14:58:42