How to install from git

Easy one-time way

Copy the URL of this “Download ZIP” link, then…

$ wp plugin install https://github.com/xxsimoxx/cpcompatibility/archive/master.zip
Downloading installation package from https://github.com/xxsimoxx/cpcompatibility/archive/master.zip...
Unpacking the package...
Installing the plugin...
Renamed Github-based project from 'cpcompatibility-master' to 'cpcompatibility'.
Plugin installed successfully.
Success: Installed 1 of 1 plugins.

I am not sure the best way to keep the plugin up to date after this.

Using git instead

cd wp-content/plugins
git clone https://github.com/xxsimoxx/cpcompatibility

When you’re ready to update the plugin:

cd wp-content/plugins/cpcompatibility
git pull origin master

git pull will work most of the time, but here is a slightly more foolproof alternative (this will try harder to overwrite any local changes and make your copy the same as what’s on the remote repository, in this case GitHub):

git fetch origin
git checkout origin/master -B master

You can also develop against this copy of the plugin, git add and git commit your changes, and then git push them to GitHub. I usually develop plugins using some variation of this technique (a git repository inside of a working site).

This is the option I would recommend, it is more complicated but also much more flexible, and you will start to learn more about how git works if you don’t already know.

5 Likes