9

如何在没有 .git 目录和 .gitignore 文件的情况下直接从远程服务器复制 git 存储库?提前从标签名称或分支。

4

2 回答 2

14

你可以使用命令

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)
于 2012-04-27T09:28:18.410 回答
0

我不知道它是否有帮助,但我的方式是递归使用 scp,忽略隐藏文件:

scp -r {git_directory}/* {target_directory}

例如:

scp -r /local/yourProjectGit/* user@machine:/home/user/dist

scp -r /local/yourProjectGit/* /local/youtProyect/dist
于 2020-11-24T16:06:42.767 回答