【问题标题】:Git Clone - Download the repository without keeping gitGit Clone - 在不保留 git 的情况下下载存储库
【发布时间】:2021-01-18 06:51:25
【问题描述】:

我想在 WP 中引入几个插件,并制作一个脚本,在 NPM 脚本中从 github 获取它们。

"installplugins": "cd ../../ && 
rm -r mu-plugins && mkdir mu-plugins && 
gh repo clone repo1 mu-plugins && 
gh repo clone repo2 mu-plugins && 
gh repo clone repo3 mu-plugins && 
gh repo clone repo4 mu-plugins && 
gh repo clone repo5 mu-plugins && 
gh repo clone repo6 mu-plugins"

问题是,就在第二个 git repo clone 时,它​​中断了,因为你的 mu-plugins 文件夹不再是空的。

真的,在一天结束时,我只需要导出 git repo 并将其放入文件夹中,而无需保留所有 git 的花里胡哨,但我似乎无法找到执行 repo 所需的标志组合下载而不是经典的 repo 克隆。

有人可以帮我吗?

【问题讨论】:

    标签: git github npm github-cli


    【解决方案1】:

    理想情况下,您可以将它们克隆到它们自己的文件夹中。

    gh repo clone repo1 mu-plugins/repo1
    gh repo clone repo1 mu-plugins/repo2
    gh repo clone repo1 mu-plugins/repo3
    

    但如果您需要mu-plugins 中的所有 repo 文件,您会:

    • 将这些存储库克隆到单独的文件夹中
    • 转到mu-plugins(假设在其中完成了git init .
    • 添加每个 repos 的文件

    即:

    cd mu-plugins
    git work-tree=../aFolder/repo1 add .
    git commit -m "Import repo1 content"
    ...
    

    【讨论】:

    • 是的,这就是我最终所做的。它们都在自己的仓库中,我先拉自动加载器,最后我删除的是 .git 文件夹,因此它不会尝试跟踪更改。
    猜你喜欢
    • 2018-08-06
    • 2013-07-21
    • 1970-01-01
    • 2021-01-27
    • 2018-07-04
    • 2017-01-06
    • 2011-09-13
    • 2012-06-10
    • 1970-01-01
    相关资源
    最近更新 更多