1

I want to bring a couple of plugins into WP and make a script that just fetches them from github within an NPM script.

"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"

Thing is, right at the second git repo clone, it breaks because you the mu-plugins folder is not empty anymore.

Really, at the end of the day I only need to export the git repo and put it in the folder, without keeping all the git bells and whistles, but I cant seem to find the combination of flags needed to do a repo download instead of a classic repo clone.

Anybody can help me on that?

Patrick
  • 2,044
  • 1
  • 25
  • 44
Fredy31
  • 2,660
  • 6
  • 29
  • 54

1 Answers1

1

Ideally, you would clone them in their own folder.

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

But if you need all the repo files in mu-plugins, you would:

  • clone those repositories in a separate folder
  • go to mu-plugins (assuming a git init . done in it)
  • add the files of each of those repos

That is:

cd mu-plugins
git work-tree=../aFolder/repo1 add .
git commit -m "Import repo1 content"
...
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Yep thats what I ended up doing. They are all in their own repos, and i pull the autoloader first, and at the end I delete is .git folder so it doesn't try to track the changes. – Fredy31 Oct 05 '20 at 13:22