The library should remain private. I don’t to publish it in a public repository at github.
Is this a wise way to share it between multiple projects?
Will it work on a server in production? How will I bring there the shared library? Or how will I statically link it to my projects in production?
I use edeliver and distillery for deploying.
Just trigger your deployment process and make sure the build machine can “see” the path dependency at the same place. It might be necessary to do a local build to achieve that.
After building edeliver will just push the compiled artifacts, but not the source code, to the actual host.
But to be honest, unless you have an umbrella or poncho project, don’t use path dependencies, and never use path dependencies living outside of your project root.
Path dependencies will eventually become a major problem when sharing the source code…
I source libraries from a private Github repo. I use SSH credentials locally and an access key in production. The access key is tied to a service account that only has read access to certain repos.
As I said there are multiple options. ANd yes it does work, I’ve been using this approach for years for private repos. Your production code shouldn’t be building your project, your CI/CD pipeline should be which creates a release for you which your prod server then runs. Your CI/CD pipeline should have access to your deploy key, see https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys for docs.
Maybe just try it and see how it works for you? Github/bitbucket/gitlab all offer free private repos for a single user.