【问题标题】:copy a git repository without revisions (without .git and .gitingore) from a remote server从远程服务器复制没有修订(没有 .git 和 .gitignore)的 git 存储库
【发布时间】:2012-04-27 09:18:40
【问题描述】:

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

【问题讨论】:

标签: git


【解决方案1】:

你可以使用命令

git archive branchname

从命名树存档文件。 IE。您可以将输出传递给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)

【讨论】:

  • 谢谢。我正在寻找类似 last command (git archive --remote=url branchname | (cd otherpath; tar x)) 的东西,但这不起作用。例如以下不工作 git archive --remote=git@github.com:gihanshp/WordPress-Widget-Boilerplate.git master| cd /tmp/
  • 你试过'git archive branchname | (cd otherpath; tar x)'?
  • 我正在尝试直接从远程服务器复制
  • 首先使用 'git clone' 制作本地副本,然后他们使用上述命令。
  • @gihan,见this answer:使用--depth 1
【解决方案2】:

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

scp -r {git_directory}/* {target_directory}

例如:

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

scp -r /local/yourProjectGit/* /local/youtProyect/dist

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多