Can I install a Library from GIT into the VS Code IDE of PlatformIO? if so How?

I don’t know if there is a way to install a library from Git but the library that is provided do not have the 3axis accelerometer library that I need. Can someone point me into the right direction, please?

If there is a library you need in a git repo, and it’s not in the PlatformIO library registry, you can pull it into your project via your platformio.ini lib_deps option by simply referencing the URL for the library…

i.e. for GitHub - philbowles/PangolinMQTT: PangolinMQTT - ArduinoIDE client library for ESP8266, ESP32 and STM32-NUCLEO

… I simply hit the copy to clipboard icon …

… and put it in the my projects platformio.ini

image

… and PlatformIO automatically installed it. You can also give it the URL of the repo (without the .git on the end) or the URL to the zip file - PlatformIO will work it out.

@pfeerick, is there a way to refer to a certain tag or release in the URL - means: not the latest one?
Thank you!

Just to repeat the question…
When this method with github link is used, how can we choose library version, or the latesest is always default?

As the documentation says, you can control which branch, tag or commit hash to pull. If not specified, it will take the latest version of the default branch.

1 Like

Thanks. So, for example, it`s:

https://github.com/platformio/platform-espressif32.git#v3.3.0

While this is technically correct, if you want to reference stable version of a built-in platform like espressif32, you would just do s documented

platform = espressif32@3.3.0

Same goes for stable library versions in lib_deps where you use semver.

You should only fall back to git links if you really need a specific commit hash or latest branch version.

1 Like