如何在没有 .git 目录和 .gitignore 文件的情况下直接从远程服务器复制 git 存储库?提前从标签名称或分支。
您可以使用
命令
git archive branchname
以存档命名树中的文件。 即,您可以将输出传递给tar
以打包文件或过滤文件,如.gitignore
(.git
不会被导出):
git archive branchname | tar -x -C c:git-my-branch
查看git help archive
了解更多详情。
相当于现有存储库中的svn export . otherpath
是
git archive branchname | (cd otherpath; tar x)
相当于svn export url otherpath
是
git archive --remote=url branchname | (cd otherpath; tar x)
我不知道
它是否有帮助,但我的方法是递归使用 scp,忽略隐藏文件:
scp -r {git_directory}/* {target_directory}
例如:
scp -r /local/yourProjectGit/* user@machine:/home/user/dist
scp -r /local/yourProjectGit/* /local/youtProyect/dist